Page MenuHomeFreeBSD

vm_map: Record the maximum size of the map over time
AcceptedPublic

Authored by markj on Oct 4 2024, 3:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 10:11 PM
Unknown Object (File)
Oct 23 2024, 5:17 AM
Unknown Object (File)
Oct 9 2024, 11:37 PM
Unknown Object (File)
Oct 7 2024, 4:43 AM
Unknown Object (File)
Oct 6 2024, 10:25 PM
Unknown Object (File)
Oct 6 2024, 8:43 AM
Unknown Object (File)
Oct 5 2024, 7:01 AM
Unknown Object (File)
Oct 5 2024, 3:26 AM
Subscribers

Details

Reviewers
alc
kib
dougm
Summary

This might be useful for some emulation layers, see bugzilla report

PR: 259940

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59781
Build 56667: arc lint + arc unit

Event Timeline

markj requested review of this revision.Oct 4 2024, 3:07 PM

In kern/kern_exec.c:exec_new_vmspace(), in case the existing vmspace is reused, I believe the maxspace needs to be reset to zero,

sys/vm/vm_map.c
1761–1764

This place should be also handled.

4926–4928

And this.

sys/sys/user.h
216

Why the new field is put there and not in kinfo_vm_layout?

markj marked 2 inline comments as done.Oct 4 2024, 3:43 PM
markj added inline comments.
sys/sys/user.h
216

Mostly because we already export the map size there. IMO it should be added to kinfo_vm_layout as well (the map size is missing there), but we might as well have it here as well so that existing users can use it conveniently.

Address kib's comments, export map size and max size in the vm_layout sysctl as well.

sys/sys/user.h
216

kinfo_vm_layout is much easier to expand, even if spaces are fully utilized. We only return kinfo_vm_layout for single process, so we can detect old programs requests by comparing the size.

While for kinfo_proc, the structure is often is returned in the array, so exhausting the spares means that we need to add yet another oid with all backward-compat machinery.

This is why I asked to move the new field to vm_layout.

sys/vm/vm_map.c
4338

I remember the previous version simply copied the vm_map.size on fork. Why change?

Avoid modifying kinfo_proc.

linprocfs will require more changes to provide VmPeak.
Drop that part of the diff for now, it is logically separate anyway.

This revision is now accepted and ready to land.Oct 5 2024, 3:18 AM