From fc453b133f8dcbe6d4953a456ea5f353680914f9 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 26 Feb 2024 22:51:36 -0500 Subject: kernel: sched: Fix mistake in context switch code Signed-off-by: Ian Moffett --- sys/kern/kern_sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index b964fc5..f61c592 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -171,10 +171,10 @@ sched_context_switch(struct trapframe *tf) struct proc *td, *next_td; /* - * If we only have one thread or even no threads, there is - * no point in preempting. + * If we have no threads, we should not + * preempt at all. */ - if (nthread == 1 || nthread == 0) { + if (nthread == 0) { goto done; } else if ((next_td = sched_dequeue_td()) == NULL) { /* Empty */ -- cgit v1.2.3