mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05: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
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…
Add table
Reference in a new issue