From c3ad4ffcece4c3693185f0de82573d93db3c3895 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 18 Aug 2022 18:56:50 +0200 Subject: [PATCH] Kernel: Schedule threads on all processors when SMP is enabled Note that SMP is still off by default, but this basically removes the weird "SMP on but threads don't get scheduled" behavior we had by default. If you pass "smp=on" to the kernel, you now get SMP. :^) --- Kernel/Scheduler.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index d674b5829c1..6fef23d6202 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2021, Andreas Kling + * Copyright (c) 2018-2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ @@ -20,9 +20,6 @@ #include #include -// Remove this once SMP is stable and can be enabled by default -#define SCHEDULE_ON_ALL_PROCESSORS 0 - namespace Kernel { RecursiveSpinlock g_scheduler_lock; @@ -451,11 +448,6 @@ void Scheduler::timer_tick(RegisterState const& regs) VERIFY(current_thread->current_trap()); VERIFY(current_thread->current_trap()->regs == ®s); -#if !SCHEDULE_ON_ALL_PROCESSORS - if (!Processor::is_bootstrap_processor()) - return; // TODO: This prevents scheduling on other CPUs! -#endif - if (current_thread->process().is_kernel_process()) { // Because the previous mode when entering/exiting kernel threads never changes // we never update the time scheduled. So we need to update it manually on the @@ -519,12 +511,7 @@ void Scheduler::idle_loop(void*) proc.idle_end(); VERIFY_INTERRUPTS_ENABLED(); -#if SCHEDULE_ON_ALL_PROCESSORS yield(); -#else - if (Processor::current_id() == 0) - yield(); -#endif } }