diff options
author | jhb <jhb@FreeBSD.org> | 2003-04-25 20:06:30 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-04-25 20:06:30 +0000 |
commit | c90ae13a7640a7d224108fb3d146ed5a8cf4275b (patch) | |
tree | 6aa5aed9de41ef2f1f8d91d3e5471c509910db95 | |
parent | ec7071fcb8d6fb89b513f3c1ffa17de488f4f379 (diff) | |
download | FreeBSD-src-c90ae13a7640a7d224108fb3d146ed5a8cf4275b.zip FreeBSD-src-c90ae13a7640a7d224108fb3d146ed5a8cf4275b.tar.gz |
- Don't bother using the proc lock to test just P_SYSTEM as that is set in
fork1() and never changes.
- The proc lock is enough to cover reading p_state, so push down sched_lock
into the PRS_NORMAL case of the switch on p_state.
-rw-r--r-- | sys/vm/vm_glue.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index 817c8cb..e6d204e 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -737,11 +737,8 @@ retry: * Perform a quick check whether * a process has P_SYSTEM. */ - PROC_LOCK(p); - if ((p->p_flag & P_SYSTEM) != 0) { - PROC_UNLOCK(p); + if ((p->p_flag & P_SYSTEM) != 0) continue; - } /* * Do not swapout a process that @@ -755,6 +752,7 @@ retry: * process may attempt to alter * the map. */ + PROC_LOCK(p); vm = p->p_vmspace; KASSERT(vm != NULL, ("swapout_procs: a process has no address space")); @@ -777,14 +775,14 @@ retry: if ((p->p_sflag & (PS_INMEM|PS_SWAPPINGOUT|PS_SWAPPINGIN)) != PS_INMEM) goto nextproc2; - mtx_lock_spin(&sched_lock); switch (p->p_state) { default: /* Don't swap out processes in any sort * of 'special' state. */ - goto nextproc; + break; case PRS_NORMAL: + mtx_lock_spin(&sched_lock); /* * do not swapout a realtime process * Check all the thread groups.. @@ -845,9 +843,9 @@ retry: sx_sunlock(&allproc_lock); goto retry; } +nextproc: + mtx_unlock_spin(&sched_lock); } -nextproc: - mtx_unlock_spin(&sched_lock); nextproc2: PROC_UNLOCK(p); vm_map_unlock(&vm->vm_map); |