diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c index f91540306158..b76c855d1d3a 100644 --- a/sys/vm/vm_glue.c +++ b/sys/vm/vm_glue.c @@ -318,10 +318,12 @@ faultin(p) ++p->p_lock; mtx_exit(&sched_lock, MTX_SPIN); + PROC_UNLOCK(p); mtx_assert(&Giant, MA_OWNED); pmap_swapin_proc(p); + PROC_LOCK(p); mtx_enter(&sched_lock, MTX_SPIN); if (p->p_stat == SRUN) { setrunqueue(p); @@ -401,8 +403,12 @@ loop: /* * We would like to bring someone in. (only if there is space). */ + PROC_LOCK(p); faultin(p); + PROC_UNLOCK(p); + mtx_enter(&sched_lock, MTX_SPIN); p->p_swtime = 0; + mtx_exit(&sched_lock, MTX_SPIN); goto loop; }