summaryrefslogtreecommitdiff
path: root/sys/kern/kern_sched.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-04-18 21:57:44 -0400
committerIan Moffett <ian@osmora.org>2025-04-18 21:57:44 -0400
commit9906547712a88cf4dc012a6f6bd6e2ad04c5e3f3 (patch)
tree41b40ec97f5082793b08a495f6a935bc3c1ed25f /sys/kern/kern_sched.c
parent0b5adaff02190dad76d845381a41b998696d9e97 (diff)
parent92d4f9dae64ab5325feca1f39e5955415e8275b9 (diff)
Merge branch 'expt' into aarch64
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern/kern_sched.c')
-rw-r--r--sys/kern/kern_sched.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 16daae2..4bbe5a0 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -33,8 +33,10 @@
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/syslog.h>
+#include <sys/atomic.h>
#include <machine/frame.h>
#include <machine/cpu.h>
+#include <machine/cdefs.h>
#include <vm/pmap.h>
#include <dev/timer.h>
#include <assert.h>
@@ -44,7 +46,7 @@
void sched_switch(struct trapframe *tf);
-static sched_policy_t policy = SCHED_POLICY_RR;
+static sched_policy_t policy = SCHED_POLICY_MLFQ;
/*
* Thread ready queues - all threads ready to be
@@ -105,12 +107,14 @@ sched_dequeue_td(void)
if (!TAILQ_EMPTY(&queue->q)) {
td = TAILQ_FIRST(&queue->q);
TAILQ_REMOVE(&queue->q, td, link);
- break;
+ spinlock_release(&tdq_lock);
+ return td;
}
}
+ /* We got nothing */
spinlock_release(&tdq_lock);
- return td;
+ return NULL;
}
/*
@@ -237,8 +241,12 @@ sched_switch(struct trapframe *tf)
void
sched_enter(void)
{
- sched_oneshot(false);
- for (;;);
+ md_inton();
+ md_sync_all();
+ for (;;) {
+ sched_oneshot(false);
+ md_pause();
+ }
}
void