From a0e38922bdb8d046a9bcf022c8324a69aa78a984 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 8 Dec 2019 00:33:35 +0100 Subject: [PATCH] Kernel: Break out of the idle loop on WaitQueue wake instead of on IRQ Now that we have proper wait queues to drive waiter wakeup, we can use the wake actions to break out of the scheduler's idle loop when we've got a thread to run. --- Kernel/Arch/i386/CPU.cpp | 5 +---- Kernel/WaitQueue.cpp | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 1b88059ade..df0c4f30af 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -3,7 +3,6 @@ #include "IRQHandler.h" #include "PIC.h" #include "Process.h" -#include "Scheduler.h" #include #include #include @@ -507,10 +506,8 @@ void handle_irq() } } - if (s_irq_handler[irq]) { + if (s_irq_handler[irq]) s_irq_handler[irq]->handle_irq(); - Scheduler::stop_idling(); - } PIC::eoi(irq); } diff --git a/Kernel/WaitQueue.cpp b/Kernel/WaitQueue.cpp index 502027367a..8531b57cdb 100644 --- a/Kernel/WaitQueue.cpp +++ b/Kernel/WaitQueue.cpp @@ -22,6 +22,7 @@ void WaitQueue::wake_one() return; if (auto* thread = m_threads.take_first()) thread->wake_from_queue(); + Scheduler::stop_idling(); } void WaitQueue::wake_all() @@ -31,4 +32,5 @@ void WaitQueue::wake_all() return; while (!m_threads.is_empty()) m_threads.take_first()->wake_from_queue(); + Scheduler::stop_idling(); }