public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Michael J. Wang" <mjwang@broadcom.com>
Cc: Yong Zhang <yong.zhang0@gmail.com>,
	"mingo@elte.hu" <mingo@elte.hu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>
Subject: RE: [PATCH 1/1] scheduler: minor improvement to pick_next_highest_task_rt in linux-3.3
Date: Wed, 21 Mar 2012 10:06:59 +0100	[thread overview]
Message-ID: <1332320819.18960.468.camel@twins> (raw)
In-Reply-To: <2EF88150C0EF2C43A218742ED384C1BC0FC8438B@IRVEXCHMB08.corp.ad.broadcom.com>

On Wed, 2012-03-21 at 07:49 +0000, Michael J. Wang wrote:
> > > Should I reformat my patch and send it again?
> > 
> > It'll be better, and I think Peter/Ingo will happy with it.
> > 
> 
> OK.  I will resend now.  Thanks for all your help!

The resend didn't include the more details thing, so I fudged it by
hand. The queued thing now looks like this:

---
Subject: sched, rt: Minor improvement to pick_next_highest_task_rt
From: Michael J Wang <mjwang@broadcom.com>
Date: Mon, 19 Mar 2012 22:26:19 +0000

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.

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.

Signed-off-by: Michael J Wang <mjwang@broadcom.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Yong Zhang <yong.zhang0@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/2EF88150C0EF2C43A218742ED384C1BC0FC83D6B@IRVEXCHMB08.corp.ad.broadcom.com
---
 kernel/sched/rt.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1428,7 +1428,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;


  reply	other threads:[~2012-03-21  9:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332320819.18960.468.camel@twins \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mjwang@broadcom.com \
    --cc=rostedt@goodmis.org \
    --cc=yong.zhang0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox