mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 06:07:59 +00:00
Kernel: Track processor idle state and wake processors when waking threads
Attempt to wake idle processors to get threads to be scheduled more quickly. We don't want to wait until the next timer tick if we have processors that aren't doing anything.
This commit is contained in:
@@ -544,13 +544,17 @@ void Scheduler::notify_finalizer()
|
||||
|
||||
void Scheduler::idle_loop(void*)
|
||||
{
|
||||
dbgln("Scheduler[{}]: idle loop running", Processor::id());
|
||||
auto& proc = Processor::current();
|
||||
dbgln("Scheduler[{}]: idle loop running", proc.get_id());
|
||||
ASSERT(are_interrupts_enabled());
|
||||
|
||||
for (;;) {
|
||||
proc.idle_begin();
|
||||
asm("hlt");
|
||||
|
||||
if (Processor::id() == 0)
|
||||
proc.idle_end();
|
||||
ASSERT_INTERRUPTS_ENABLED();
|
||||
if (Processor::current().id() == 0)
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user