Lock the proc to check p_flag and several other related tests in

vm_daemon().  We don't need to hold sched_lock as long now as a result.
This commit is contained in:
jhb 2003-04-22 20:03:08 +00:00
parent d5cf4c5275
commit 18f0a39a3f

View File

@ -1543,7 +1543,9 @@ vm_daemon()
* if this is a system process or if we have already * if this is a system process or if we have already
* looked at this process, skip it. * looked at this process, skip it.
*/ */
PROC_LOCK(p);
if (p->p_flag & (P_SYSTEM | P_WEXIT)) { if (p->p_flag & (P_SYSTEM | P_WEXIT)) {
PROC_UNLOCK(p);
continue; continue;
} }
/* /*
@ -1560,8 +1562,9 @@ vm_daemon()
break; break;
} }
} }
mtx_unlock_spin(&sched_lock);
if (breakout) { if (breakout) {
mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p);
continue; continue;
} }
/* /*
@ -1578,7 +1581,7 @@ vm_daemon()
*/ */
if ((p->p_sflag & PS_INMEM) == 0) if ((p->p_sflag & PS_INMEM) == 0)
limit = 0; /* XXX */ limit = 0; /* XXX */
mtx_unlock_spin(&sched_lock); PROC_UNLOCK(p);
size = vmspace_resident_count(p->p_vmspace); size = vmspace_resident_count(p->p_vmspace);
if (limit >= 0 && size >= limit) { if (limit >= 0 && size >= limit) {