Skip to content

[gc-stats][macos] Exclude the runtime events ring from max RSS on macOS - #152

Open
ngorogiannis wants to merge 1 commit into
linux-rss-without-ringfrom
mac-rss-without-ring
Open

ngorogiannis wants to merge 1 commit into
linux-rss-without-ringfrom
mac-rss-without-ring

Conversation

@ngorogiannis

Copy link
Copy Markdown
Collaborator

The macOS arm of the exclusion the previous commit added for Linux.

The ring's share is sized, per sample, by walking the child's VM regions
with proc_pidinfo(PROC_PIDREGIONPATHINFO) and summing pri_pages_resident
over those whose backing vnode matches a stat() of .events. Matching
is on device+inode rather than the region path, which the kernel
truncates for long paths and which need not be canonical; adjacent
regions are summed, since a large mapping can be split across several.
The mapping never moves, so its address is cached.

Unlike Linux, the count comes from the backing region rather than the
child's own page tables, so it can in principle exceed the child's RSS.

FreeBSD still reports the RSS with the ring included, and is left as
further work.


Stack created with GitHub Stacks CLI • Give Feedback 💬

@ngorogiannis
ngorogiannis added this pull request to stack #153 September 22, 2026 10:46
@ngorogiannis
ngorogiannis removed this pull request from stack #153 September 23, 2026 07:22
@ngorogiannis
ngorogiannis added this pull request to stack #156 September 23, 2026 07:25
@ngorogiannis
ngorogiannis force-pushed the mac-rss-without-ring branch 3 times, most recently from b7ea9fe to a810c1f Compare November 10, 2026 18:27
@ngorogiannis
ngorogiannis marked this pull request as draft November 11, 2026 08:03
@ngorogiannis
ngorogiannis force-pushed the mac-rss-without-ring branch 5 times, most recently from 653121c to a68abbe Compare November 13, 2026 14:16
The macOS arm of the exclusion the previous commit added for Linux.

The ring's share is sized, per sample, by walking the child's VM regions
with proc_pidinfo(PROC_PIDREGIONPATHINFO) and summing pri_pages_resident
over those whose backing vnode matches a stat() of <pid>.events. Matching
is on device+inode rather than the region path, which the kernel
truncates for long paths and which need not be canonical; adjacent
regions are summed, since a large mapping can be split across several.
The mapping never moves, so its address is cached.

Unlike Linux, the count comes from the backing region rather than the
child's own page tables, so it can in principle exceed the child's RSS.

FreeBSD still reports the RSS with the ring included, and is left as
further work.
@ngorogiannis
ngorogiannis marked this pull request as ready for review November 13, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant