1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:55:12 +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:
Tom 2020-10-28 16:06:16 -06:00 committed by Andreas Kling
parent 39f408daa0
commit c531084873
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();