aboutsummaryrefslogtreecommitdiff
path: root/sys/vm/vm_glue.c
diff options
context:
space:
mode:
authorJason Evans <jasone@FreeBSD.org>2000-09-07 01:33:02 +0000
committerJason Evans <jasone@FreeBSD.org>2000-09-07 01:33:02 +0000
commit0384fff8c5b098545c3db311b0e0aa1ec4c9ae7e (patch)
treebc6e36e781569f3efe04995c0b0befebb9154ef5 /sys/vm/vm_glue.c
parent62ae6c89ad2b03770097d05590093f93b9d94e08 (diff)
downloadsrc-0384fff8c5b098545c3db311b0e0aa1ec4c9ae7e.tar.gz
src-0384fff8c5b098545c3db311b0e0aa1ec4c9ae7e.zip
Major update to the way synchronization is done in the kernel. Highlights
include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
Notes
Notes: svn path=/head/; revision=65557
Diffstat (limited to 'sys/vm/vm_glue.c')
-rw-r--r--sys/vm/vm_glue.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/vm/vm_glue.c b/sys/vm/vm_glue.c
index 849a30affd60..ea39d7f1305c 100644
--- a/sys/vm/vm_glue.c
+++ b/sys/vm/vm_glue.c
@@ -74,9 +74,11 @@
#include <sys/sysctl.h>
#include <sys/kernel.h>
+#include <sys/ktr.h>
#include <sys/unistd.h>
#include <machine/limits.h>
+#include <machine/mutex.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -316,8 +318,11 @@ faultin(p)
s = splhigh();
- if (p->p_stat == SRUN)
+ if (p->p_stat == SRUN) {
+ mtx_enter(&sched_lock, MTX_SPIN);
setrunqueue(p);
+ mtx_exit(&sched_lock, MTX_SPIN);
+ }
p->p_flag |= P_INMEM;
@@ -332,6 +337,8 @@ faultin(p)
* This swapin algorithm attempts to swap-in processes only if there
* is enough space for them. Of course, if a process waits for a long
* time, it will be swapped in anyway.
+ *
+ * Giant is still held at this point, to be released in tsleep.
*/
/* ARGSUSED*/
static void
@@ -343,6 +350,8 @@ scheduler(dummy)
struct proc *pp;
int ppri;
+ mtx_assert(&Giant, MA_OWNED);
+
loop:
if (vm_page_count_min()) {
VM_WAIT;