diff options
author | avg <avg@FreeBSD.org> | 2017-02-27 17:18:05 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2017-02-27 17:18:05 +0000 |
commit | 1dc77a085c43cbefecfb63a858041224e8f737b1 (patch) | |
tree | cd8490ba37d9b406b7b079840003b297bb31b430 | |
parent | c7136ea0d82fe5c962d32f90368c4a60517eed35 (diff) | |
download | FreeBSD-src-1dc77a085c43cbefecfb63a858041224e8f737b1.zip FreeBSD-src-1dc77a085c43cbefecfb63a858041224e8f737b1.tar.gz |
MFC r313730: try to fix RACCT_RSS accounting
-rw-r--r-- | sys/kern/kern_racct.c | 5 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index 8c2f0ac..2a22af1 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -1014,10 +1014,13 @@ racct_proc_exit(struct proc *p) racct_set_locked(p, RACCT_CPU, runtime, 0); racct_add_cred_locked(p->p_ucred, RACCT_PCTCPU, pct); + KASSERT(p->p_racct->r_resources[RACCT_RSS] == 0, + ("process reaped with %ju allocated for RSS\n", + p->p_racct->r_resources[RACCT_RSS])); for (i = 0; i <= RACCT_MAX; i++) { if (p->p_racct->r_resources[i] == 0) continue; - if (!RACCT_IS_RECLAIMABLE(i)) + if (!RACCT_IS_RECLAIMABLE(i)) continue; racct_set_locked(p, i, 0, 0); } diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index ed9d439..a2b2ddb 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1806,12 +1806,14 @@ again: if (size >= limit) { vm_pageout_map_deactivate_pages( &vm->vm_map, limit); + size = vmspace_resident_count(vm); } #ifdef RACCT if (racct_enable) { rsize = IDX_TO_OFF(size); PROC_LOCK(p); - racct_set(p, RACCT_RSS, rsize); + if (p->p_state == PRS_NORMAL) + racct_set(p, RACCT_RSS, rsize); ravailable = racct_get_available(p, RACCT_RSS); PROC_UNLOCK(p); if (rsize > ravailable) { @@ -1837,7 +1839,8 @@ again: size = vmspace_resident_count(vm); rsize = IDX_TO_OFF(size); PROC_LOCK(p); - racct_set(p, RACCT_RSS, rsize); + if (p->p_state == PRS_NORMAL) + racct_set(p, RACCT_RSS, rsize); PROC_UNLOCK(p); if (rsize > ravailable) tryagain = 1; |