mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-13 01:40:36 +00:00
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. :^)
This commit is contained in:
parent
b560442fe1
commit
c3ad4ffcec
Notes:
sideshowbarker
2024-07-17 23:02:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c3ad4ffcec
1 changed files with 1 additions and 14 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -20,9 +20,6 @@
|
|||
#include <Kernel/Time/TimeManagement.h>
|
||||
#include <Kernel/kstdio.h>
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue