linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>,
	Ingo Molnar <mingo@elte.hu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] sched/rt: Remove redundant check before push_rt_task()
Date: Fri, 25 May 2012 09:08:42 -0400	[thread overview]
Message-ID: <1337951322.13348.246.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1337938798.9783.172.camel@laptop>

On Fri, 2012-05-25 at 11:39 +0200, Peter Zijlstra wrote:
> On Fri, 2012-05-25 at 15:43 +0900, Hiroshi Shimamoto wrote:
> > From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> > 
> > Currently rq->rt.overloaded is checked twice in switched_to_rt().
> > Remove the first one which out of push_rt_task().
> 
> Steven was this on purpose to avoid the call or can I apply this thing?
> 

Yeah, I think I added that as a way to avoid the call, but I never did
any benchmarks to see if it was actually better (extra check to avoid
the call, or just do the call and remove the duplicate check).

It would be a good idea to see how ofter that check happens in the real
world. As two or more RT tasks on the same CPU is only something that
happens on a real RT system (as the common case that is).

It's a micro optimization, as a double duplicate check should be fast as
everything is nicely in the cache line. But an extra call may be
expensive. But it's not a big difference to me if you take the patch or
not.

> > Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> > ---
> >  kernel/sched/rt.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> > index c5565c3..a601a70 100644
> > --- a/kernel/sched/rt.c
> > +++ b/kernel/sched/rt.c
> > @@ -1907,7 +1907,7 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
> >  	 */
> >  	if (p->on_rq && rq->curr != p) {
> >  #ifdef CONFIG_SMP
> > -		if (rq->rt.overloaded && push_rt_task(rq) &&
> > +		if (push_rt_task(rq) &&
> >  		    /* Don't resched if we changed runqueues */
> >  		    rq != task_rq(p))

If you decide to take this patch, it may be better to switch it to:

		/* Don't resched if we changed runqueues */
		if (push_rt_task(rq) && rq != task_rq(p))

-- Steve



> >  			check_resched = 0;
> 
> 



  reply	other threads:[~2012-05-25 13:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25  6:41 [PATCH 1/3] sched: Make sched_feat_names const Hiroshi Shimamoto
2012-05-25  6:42 ` [PATCH 2/3] sched: Remove the last NULL entry from sched_feat_names Hiroshi Shimamoto
2012-05-30 13:42   ` [tip:sched/urgent] " tip-bot for Hiroshi Shimamoto
2012-05-25  6:43 ` [PATCH 3/3] sched/rt: Remove redundant check before push_rt_task() Hiroshi Shimamoto
2012-05-25  9:39   ` Peter Zijlstra
2012-05-25 13:08     ` Steven Rostedt [this message]
2012-05-30 13:41 ` [tip:sched/urgent] sched: Make sched_feat_names const tip-bot for Hiroshi Shimamoto

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=1337951322.13348.246.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=h-shimamoto@ct.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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;
as well as URLs for NNTP newsgroup(s).