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:
Tom 2020-10-28 16:06:16 -06:00 committed by Andreas Kling
commit c531084873
Notes: sideshowbarker 2024-07-18 22:48:46 +09:00
4 changed files with 72 additions and 3 deletions

View file

@ -919,7 +919,9 @@ void Thread::set_state(State new_state, u8 stop_signal)
}
}
if (m_state == Stopped) {
if (m_state == Runnable) {
Processor::smp_wake_n_idle_processors(1);
} else if (m_state == Stopped) {
// We don't want to restore to Running state, only Runnable!
m_stop_state = previous_state != Running ? previous_state : Runnable;
auto& process = this->process();