[lkml]   [2012]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 1/1] scheduler: minor improvement to pick_next_highest_task_rt in linux-3.3
From: Michael J Wang <>

Avoid extra work by continuing on to the next rt_rq if the highest prio task in current rt_rq is the same priority as our candidate task.

Signed-off-by: Michael J Wang <>


More detailed explanation: if next is not NULL, then we have found a candidate task, and its priority is next->prio. Now we are looking for an even higher priority task in the other rt_rq's. idx is the highest priority in the current candidate rt_rq. In the current 3.3 code, if idx is equal to next->prio, we would start scanning the tasks in that rt_rq and replace the current candidate task with a task from that rt_rq. But the new task would only have a priority that is equal to our previous candidate task, so we have not advanced our goal of finding a higher prio task. So we should avoid the extra work by continuing on to the next rt_rq if idx is equal to next->prio.

--- linux-3.3/kernel/sched/rt.c.orig 2012-03-18 16:15:34.000000000 -0700
+++ linux-3.3/kernel/sched/rt.c 2012-03-19 14:52:54.585391702 -0700
@@ -1403,7 +1403,7 @@ static struct task_struct *pick_next_hig
if (idx >= MAX_RT_PRIO)
- if (next && next->prio < idx)
+ if (next && next->prio <= idx)
list_for_each_entry(rt_se, array->queue + idx, run_list) {
struct task_struct *p;

 \ /
  Last update: 2012-03-19 23:29    [W:0.186 / U:2.624 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site