Do a better job of calculating the RSS for swapped-out processes:
don't include the kernel stacks of swapped-out threads in the page count, but do include the alternate kernel stack. jhb provided some helpful comments on this. PR: 49102
This commit is contained in:
parent
0ca929541c
commit
bf8bb3cbd9
@ -662,10 +662,16 @@ fill_kinfo_proc(p, kp)
|
||||
|
||||
kp->ki_size = vm->vm_map.size;
|
||||
kp->ki_rssize = vmspace_resident_count(vm); /*XXX*/
|
||||
if (p->p_sflag & PS_INMEM)
|
||||
if (p->p_sflag & PS_INMEM) {
|
||||
kp->ki_rssize += UAREA_PAGES;
|
||||
FOREACH_THREAD_IN_PROC(p, td0)/* XXXKSE: thread swapout check */
|
||||
kp->ki_rssize += KSTACK_PAGES;
|
||||
FOREACH_THREAD_IN_PROC(p, td0) {
|
||||
if (!TD_IS_SWAPPED(td0))
|
||||
kp->ki_rssize += td0->td_kstack_pages;
|
||||
if (td0->td_altkstack_obj != NULL)
|
||||
kp->ki_rssize +=
|
||||
td0->td_altkstack_pages;
|
||||
}
|
||||
}
|
||||
kp->ki_swrss = vm->vm_swrss;
|
||||
kp->ki_tsize = vm->vm_tsize;
|
||||
kp->ki_dsize = vm->vm_dsize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user