public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] scheduler: minor improvement to pick_next_highest_task_rt in linux-3.3
@ 2012-03-19 22:26 Michael J. Wang
  2012-03-20 13:59 ` Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Michael J. Wang @ 2012-03-19 22:26 UTC (permalink / raw)
  To: mingo@elte.hu, peterz@infradead.org
  Cc: Michael J. Wang, linux-kernel@vger.kernel.org,
	rostedt@goodmis.org, yong.zhang0@gmail.com

From: Michael J Wang <mjwang@broadcom.com>

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 <mjwang@broadcom.com>

---

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
 next_idx:
 		if (idx >= MAX_RT_PRIO)
 			continue;
-		if (next && next->prio < idx)
+		if (next && next->prio <= idx)
 			continue;
 		list_for_each_entry(rt_se, array->queue + idx, run_list) {
 			struct task_struct *p;







^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-03-27 15:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-19 22:26 [PATCH 1/1] scheduler: minor improvement to pick_next_highest_task_rt in linux-3.3 Michael J. Wang
2012-03-20 13:59 ` Steven Rostedt
2012-03-21  1:40 ` Yong Zhang
2012-03-21  1:56   ` Michael J. Wang
2012-03-21  2:12     ` Yong Zhang
2012-03-21  7:49       ` Michael J. Wang
2012-03-21  9:06         ` Peter Zijlstra
2012-03-21 18:33           ` Michael J. Wang
2012-03-21 19:35             ` Peter Zijlstra
2012-03-22  7:50               ` Ingo Molnar
2012-03-27 15:35 ` [tip:sched/urgent] sched/rt: Improve pick_next_highest_task_rt() tip-bot for Michael J Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox