aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_pageout.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2001-01-24 11:28:36 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2001-01-24 11:28:36 +0000
commit8606d880439cf42bbb041acdb542f4f1261f3d62 (patch)
tree0eead213b2454e11b9ddb2253dd9e0c6ac1a3bde /sys/vm/vm_pageout.c
parente2181d41d0a90ffca3d5e3df6be3218ca1320e4f (diff)
downloadsrc-8606d880439cf42bbb041acdb542f4f1261f3d62.tar.gz
src-8606d880439cf42bbb041acdb542f4f1261f3d62.zip
- Catch up to proc flag changes.
- Minimal proc locking. - Use queue macros.
Notes
Notes: svn path=/head/; revision=71572
Diffstat (limited to 'sys/vm/vm_pageout.c')
-rw-r--r--sys/vm/vm_pageout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
index 943fb1178e52..0dd7ecbdf56d 100644
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -1124,15 +1124,18 @@ rescan0:
bigproc = NULL;
bigsize = 0;
ALLPROC_LOCK(AP_SHARED);
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
+ LIST_FOREACH(p, &allproc, p_list) {
/*
* if this is a system process, skip it
*/
+ PROC_LOCK(p);
if ((p->p_flag & P_SYSTEM) || (p->p_lock > 0) ||
(p->p_pid == 1) ||
((p->p_pid < 48) && (vm_swap_size != 0))) {
+ PROC_UNLOCK(p);
continue;
}
+ PROC_UNLOCK(p);
/*
* if the process is in a non-running type state,
* don't touch it.
@@ -1159,9 +1162,11 @@ rescan0:
ALLPROC_LOCK(AP_RELEASE);
if (bigproc != NULL) {
killproc(bigproc, "out of swap space");
+ mtx_enter(&sched_lock, MTX_SPIN);
bigproc->p_estcpu = 0;
bigproc->p_nice = PRIO_MIN;
resetpriority(bigproc);
+ mtx_exit(&sched_lock, MTX_SPIN);
wakeup(&cnt.v_free_count);
}
}
@@ -1477,7 +1482,6 @@ vm_daemon()
mtx_exit(&sched_lock, MTX_SPIN);
continue;
}
- mtx_exit(&sched_lock, MTX_SPIN);
/*
* get a limit
*/
@@ -1490,8 +1494,9 @@ vm_daemon()
* swapped out set the limit to nothing (will force a
* swap-out.)
*/
- if ((p->p_flag & P_INMEM) == 0)
+ if ((p->p_sflag & PS_INMEM) == 0)
limit = 0; /* XXX */
+ mtx_exit(&sched_lock, MTX_SPIN);
size = vmspace_resident_count(p->p_vmspace);
if (limit >= 0 && size >= limit) {