Skip to content

On Linux, use PR_SET_VMA_ANON_NAME to name memory mappings #3351

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

stedolan
Copy link
Contributor

@stedolan stedolan commented Dec 9, 2024

This new Linux prctl call allows a name to be set for anonymous memory mappings. This is useful for debugging (especially performance debugging), as the names show up in /proc/$PID/smaps and are not coalesced with other mappings. (This means that questions like "how much of this process's RSS is OCaml heap" are answerable from smaps).

On a kernel that supports it, here's what part of smaps looks like:

7fa54de00000-7fa54e600000 rw-p 00000000 00:00 0                          [anon:OCaml: minor heap 0]
Size:               8192 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                4096 kB
Pss:                4096 kB
Pss_Dirty:          4096 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:      4096 kB
Referenced:         4096 kB
Anonymous:          4096 kB
LazyFree:              0 kB
AnonHugePages:      4096 kB
ShmemPmdMapped:        0 kB
FilePmdMapped:         0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
THPeligible:    1
VmFlags: rd wr mr mw me ac sd 

Copy link
Collaborator

@mshinwell mshinwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good and ok to merge, but a couple of suggestions for potentially useful improvements.

@stedolan stedolan merged commit 41bc7c2 into ocaml-flambda:main Dec 17, 2024
19 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants