summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_glue.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-10-25 00:04:16 +0000
committerjhb <jhb@FreeBSD.org>2000-10-25 00:04:16 +0000
commit9ae17765f4740fe141af70bd43e76df819daaec7 (patch)
tree009d090bd2f28fd50dc302cf7c2b9dd49cb2a854 /sys/vm/vm_glue.c
parentb8040f9ced260ed168c0b5f3565c979e081f4a78 (diff)
downloadFreeBSD-src-9ae17765f4740fe141af70bd43e76df819daaec7.zip
FreeBSD-src-9ae17765f4740fe141af70bd43e76df819daaec7.tar.gz
- Catch a machine/mutex.h -> sys/mutex.h I somehow missed.
- Close a small race condition. The sched_lock mutex protects p->p_stat as well as the run queues. Another CPU could change p_stat of the process while we are waiting for the lock, and we would end up scheduling a process that isn't runnable.
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index ea39d7f..82e22ba 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -75,10 +75,10 @@
#include <sys/kernel.h>
#include <sys/ktr.h>
+#include <sys/mutex.h>
#include <sys/unistd.h>
#include <machine/limits.h>
-#include <machine/mutex.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -318,11 +318,11 @@ faultin(p)
s = splhigh();
+ mtx_enter(&sched_lock, MTX_SPIN);
if (p->p_stat == SRUN) {
- mtx_enter(&sched_lock, MTX_SPIN);
setrunqueue(p);
- mtx_exit(&sched_lock, MTX_SPIN);
}
+ mtx_exit(&sched_lock, MTX_SPIN);
p->p_flag |= P_INMEM;
OpenPOWER on IntegriCloud