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:
Yongcong Du
2012-05-13 19:06:47 +02:00
committed by Fredrik Holmqvist
parent 229e112eb4
commit 44c3c03412
3 changed files with 9 additions and 6 deletions
@@ -500,6 +500,7 @@ affine_reschedule(void)
&& nextThread->priority < B_NORMAL_PRIORITY) && nextThread->priority < B_NORMAL_PRIORITY)
quantum = kMaxThreadQuantum; quantum = kMaxThreadQuantum;
if (!thread_is_idle_thread(nextThread))
add_timer(quantumTimer, &reschedule_event, quantum, add_timer(quantumTimer, &reschedule_event, quantum,
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK); B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
@@ -324,6 +324,7 @@ simple_reschedule(void)
cancel_timer(quantumTimer); cancel_timer(quantumTimer);
oldThread->cpu->preempted = 0; oldThread->cpu->preempted = 0;
if (!thread_is_idle_thread(nextThread))
add_timer(quantumTimer, &reschedule_event, quantum, add_timer(quantumTimer, &reschedule_event, quantum,
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK); B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);
@@ -423,6 +423,7 @@ reschedule(void)
cancel_timer(quantumTimer); cancel_timer(quantumTimer);
oldThread->cpu->preempted = 0; oldThread->cpu->preempted = 0;
if (!thread_is_idle_thread(nextThread))
add_timer(quantumTimer, &reschedule_event, quantum, add_timer(quantumTimer, &reschedule_event, quantum,
B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK); B_ONE_SHOT_RELATIVE_TIMER | B_TIMER_ACQUIRE_SCHEDULER_LOCK);