Page MenuHomeFreeBSD

Add sysctl vm.objects_swap

Authored by kib on Jul 13 2021, 10:37 AM.



vm.objects_swap: disable reporting some information

For making the call faster, do not count active/inactive object queues, and do not report vnode info if any (for tmpfs).

See D29754

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Jul 13 2021, 10:37 AM
kib created this revision.

Add the 'yield if hog' patch


Why examine objects with OBJ_ANON set and OBJ_SWAP clear?


Because these are logically swap objects. The fact that the system yet did not swapped anything from their page queue does not imply anything.

Hm, even more, if I skip such objects there, then sysinfo(8) would not be able to reconstruct full shadow chain. So it is not the question of interpretation, but in fact required to do.

markj added inline comments.

I think this deserves a comment, then, since swap_only is not quite accurate. Naively I understand that the new sysctl is used to display information about swap usage, and it is tempting to "optimize" this loop by excluding OBJT_DEFAULT objects since by definition they have never undergone pageouts.


You could avoid calling pgo_getvp calls in vm_object_kvme_type() by passing swap_only ? NULL : &vp instead (with vp initialized to NULL).

This revision is now accepted and ready to land.Oct 25 2021, 1:18 PM
kib marked 3 inline comments as done.

Optimize vp calculation.
Add detailed comment about new sysctl.

This revision now requires review to proceed.Oct 25 2021, 1:45 PM
This revision is now accepted and ready to land.Oct 25 2021, 1:56 PM