From 18f0a39a3fe1da16212e6fc2c570431b6fac7fff Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 22 Apr 2003 20:03:08 +0000 Subject: [PATCH] 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. --- sys/vm/vm_pageout.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 4139e714692a..9c5afcf87e29 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1543,7 +1543,9 @@ vm_daemon() * if this is a system process or if we have already * looked at this process, skip it. */ + PROC_LOCK(p); if (p->p_flag & (P_SYSTEM | P_WEXIT)) { + PROC_UNLOCK(p); continue; } /* @@ -1560,8 +1562,9 @@ vm_daemon() break; } } + mtx_unlock_spin(&sched_lock); if (breakout) { - mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(p); continue; } /* @@ -1578,7 +1581,7 @@ vm_daemon() */ if ((p->p_sflag & PS_INMEM) == 0) limit = 0; /* XXX */ - mtx_unlock_spin(&sched_lock); + PROC_UNLOCK(p); size = vmspace_resident_count(p->p_vmspace); if (limit >= 0 && size >= limit) {