summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-04-22 20:03:08 +0000
committerjhb <jhb@FreeBSD.org>2003-04-22 20:03:08 +0000
commit18f0a39a3fe1da16212e6fc2c570431b6fac7fff (patch)
tree2e7a5acc6c0f4cc30a2d1f1c83946de053cc7a7c
parentd5cf4c5275f6e664075d1972274e99a697bd6823 (diff)
downloadFreeBSD-src-18f0a39a3fe1da16212e6fc2c570431b6fac7fff.zip
FreeBSD-src-18f0a39a3fe1da16212e6fc2c570431b6fac7fff.tar.gz
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.
-rw-r--r--sys/vm/vm_pageout.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 4139e71..9c5afcf 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) {
OpenPOWER on IntegriCloud