From 5bce4ae3bed550e33a5390d599f4ea1cfa9f4190 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Mon, 8 Oct 2007 23:37:28 +0000 Subject: [PATCH] - Fix ULE in kernels without PREEMPTION compiled in by always enabling the critical_exit() owepreempt check. ULE will always use owepreempt to preempt the idle thread. This change does not effect 4BSD since it will never set owepreempt without PREEMPTION enabled. - Remove some unused code from choosethread(). Discussed with: jhb Approved by: re --- sys/kern/kern_switch.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/sys/kern/kern_switch.c b/sys/kern/kern_switch.c index 8ff7092a658..994e604b9fa 100644 --- a/sys/kern/kern_switch.c +++ b/sys/kern/kern_switch.c @@ -133,16 +133,6 @@ choosethread(void) { struct thread *td; -#if defined(SMP) && (defined(__i386__) || defined(__amd64__)) - if (smp_active == 0 && PCPU_GET(cpuid) != 0) { - /* Shutting down, run idlethread on AP's */ - td = PCPU_GET(idlethread); - CTR1(KTR_RUNQ, "choosethread: td=%p (idle)", td); - TD_SET_RUNNING(td); - return (td); - } -#endif - retry: td = sched_choose(); @@ -184,7 +174,7 @@ critical_exit(void) td = curthread; KASSERT(td->td_critnest != 0, ("critical_exit: td_critnest == 0")); -#ifdef PREEMPTION + if (td->td_critnest == 1) { td->td_critnest = 0; if (td->td_owepreempt) { @@ -196,7 +186,6 @@ critical_exit(void) thread_unlock(td); } } else -#endif td->td_critnest--; CTR4(KTR_CRITICAL, "critical_exit by thread %p (%ld, %s) to %d", td,