scheduler: Don't setup the quantumTimer for idle thread
Let's say the timer is waken up when its hook is called. This patch reduces ~41% wakeups during idle Signed-off-by: Fredrik Holmqvist <[email protected]>
This commit is contained in:
committed by
Fredrik Holmqvist
parent
229e112eb4
commit
44c3c03412
@@ -500,8 +500,9 @@ affine_reschedule(void)
|
|||||||
&& nextThread->priority < B_NORMAL_PRIORITY)
|
&& nextThread->priority < B_NORMAL_PRIORITY)
|
||||||
quantum = kMaxThreadQuantum;
|
quantum = kMaxThreadQuantum;
|
||||||
|
|
||||||
add_timer(quantumTimer, &reschedule_event, quantum,
|
if (!thread_is_idle_thread(nextThread))
|
||||||
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
|
add_timer(quantumTimer, &reschedule_event, quantum,
|
||||||
|
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
|
||||||
|
|
||||||
if (nextThread != oldThread)
|
if (nextThread != oldThread)
|
||||||
scheduler_switch_thread(oldThread, nextThread);
|
scheduler_switch_thread(oldThread, nextThread);
|
||||||
|
|||||||
@@ -324,8 +324,9 @@ simple_reschedule(void)
|
|||||||
cancel_timer(quantumTimer);
|
cancel_timer(quantumTimer);
|
||||||
|
|
||||||
oldThread->cpu->preempted = 0;
|
oldThread->cpu->preempted = 0;
|
||||||
add_timer(quantumTimer, &reschedule_event, quantum,
|
if (!thread_is_idle_thread(nextThread))
|
||||||
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
|
add_timer(quantumTimer, &reschedule_event, quantum,
|
||||||
|
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
|
||||||
|
|
||||||
if (nextThread != oldThread)
|
if (nextThread != oldThread)
|
||||||
scheduler_switch_thread(oldThread, nextThread);
|
scheduler_switch_thread(oldThread, nextThread);
|
||||||
|
|||||||
@@ -423,8 +423,9 @@ reschedule(void)
|
|||||||
cancel_timer(quantumTimer);
|
cancel_timer(quantumTimer);
|
||||||
|
|
||||||
oldThread->cpu->preempted = 0;
|
oldThread->cpu->preempted = 0;
|
||||||
add_timer(quantumTimer, &reschedule_event, quantum,
|
if (!thread_is_idle_thread(nextThread))
|
||||||
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
|
add_timer(quantumTimer, &reschedule_event, quantum,
|
||||||
|
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
|
||||||
|
|
||||||
if (nextThread != oldThread)
|
if (nextThread != oldThread)
|
||||||
scheduler_switch_thread(oldThread, nextThread);
|
scheduler_switch_thread(oldThread, nextThread);
|
||||||
|
|||||||
Reference in New Issue
Block a user