mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Kernel: Add a compile-time switch to enable scheduling on all CPUs
This is meant to be temporary only and should be removed once scheduling on all CPUs is stable.
This commit is contained in:
parent
e9e76b8074
commit
db1448b21a
Notes:
sideshowbarker
2024-07-18 22:48:22 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/db1448b21a2 Pull-request: https://github.com/SerenityOS/serenity/pull/5073
1 changed files with 9 additions and 0 deletions
|
@ -36,6 +36,9 @@
|
|||
#include <Kernel/Time/TimeManagement.h>
|
||||
#include <Kernel/TimerQueue.h>
|
||||
|
||||
// Remove this once SMP is stable and can be enabled by default
|
||||
#define SCHEDULE_ON_ALL_PROCESSORS 0
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
class SchedulerPerProcessorData {
|
||||
|
@ -550,9 +553,11 @@ void Scheduler::timer_tick(const RegisterState& regs)
|
|||
ASSERT(current_thread->current_trap());
|
||||
ASSERT(current_thread->current_trap()->regs == ®s);
|
||||
|
||||
#if !SCHEDULE_ON_ALL_PROCESSORS
|
||||
bool is_bsp = Processor::id() == 0;
|
||||
if (!is_bsp)
|
||||
return; // TODO: This prevents scheduling on other CPUs!
|
||||
#endif
|
||||
if (current_thread->process().is_profiling()) {
|
||||
ASSERT(current_thread->process().perf_events());
|
||||
auto& perf_events = *current_thread->process().perf_events();
|
||||
|
@ -616,8 +621,12 @@ void Scheduler::idle_loop(void*)
|
|||
|
||||
proc.idle_end();
|
||||
ASSERT_INTERRUPTS_ENABLED();
|
||||
#if SCHEDULE_ON_ALL_PROCESSORS
|
||||
yield();
|
||||
#else
|
||||
if (Processor::current().id() == 0)
|
||||
yield();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue