resident stack size

Matthew Dillon dillon at
Sun May 2 21:38:37 PDT 2010

:I went through the code for top in /contrib/top/ but their was no specific
:information about the functions being called for getting the resident stack
:Or any construct which gives the resident stack size.
:Theirs the function get_process_info and get_system_info (definition resides
:in one of the file) but they give the cpu and memory usage statistics/ time
:If you know how does it gets the resident stack size, please tell me.
:Till then I will go through it again.
:Pratyush Kshirsgar.

    I think you meant "Resident Set Size", meaning the number of active
    VM pages associated with a process.

    It is a long convoluted chain.

    The code is in /usr/src/usr.bin/top/m_dragonfly.c.  It looks like
    the value is pulled out of the kinfo_proc structure returned by
    the kernel.

    The code in the kernel is in /usr/src/sys/kern/kern_kinfo.c,
    around line 149, calling the function vmspace_resident_count()
    which is in vm/vm_map.h which calls pmap_resident_count() which
    pulls the data out of the process pmap's pm_stats.resident_count


More information about the Kernel mailing list