Why kinfo_getvmmap is sometimes so expensive?

Yuri yuri at rawbw.com
Thu Jul 7 01:55:58 UTC 2016


On 07/06/2016 17:19, Konstantin Belousov wrote:
> To calculate residency count for the process map entries, kernel has to
> iterate over all pages.  This operation was somewhat optimized in 10.3
> and HEAD, particularly for the large sparce mappings.  But for large populated
> mappings there is no other way then to check each page.
>
> You may confirm my hypothesis by setting sysctl
> kern.proc_vmmap_skip_resident_count to 0 and see whether the CPU
> consumption changed.  Of course, you will not get the resident count
> in the returned structure, after the knob is tweaked.


Yes, this explains it. kern.proc_vmmap_skip_resident_count=0 made CPU 
consumption to go down.

So, it is better to parse /proc/<pid>/map to get the process size.


Thank you,

Yuri



More information about the freebsd-hackers mailing list