public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Michael wang <wangyun@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Juri Lelli <juri.lelli@gmail.com>
Subject: Re: [RFC PATCH] sched: make sure sched-priority after invoke idle_balance()
Date: Mon, 17 Feb 2014 12:24:20 +0100	[thread overview]
Message-ID: <20140217112420.GD15586@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <53018284.5070408@linux.vnet.ibm.com>

On Mon, Feb 17, 2014 at 11:31:16AM +0800, Michael wang wrote:
> >  pick_next_task(struct rq *rq, struct task_struct *prev)
> >  {
> > -	const struct sched_class *class;
> > +	const struct sched_class *class = &fair_sched_class;
> >  	struct task_struct *p;
> > 
> >  	/*
> >  	 * Optimization: we know that if all tasks are in
> >  	 * the fair class we can call that function directly:
> >  	 */
> > -	if (likely(prev->sched_class == &fair_sched_class &&
> > +	if (likely(prev->sched_class == class &&
> >  		   rq->nr_running == rq->cfs.h_nr_running)) {
> >  		p = fair_sched_class.pick_next_task(rq, prev);
> >  		if (likely(p))
> > -			return p;
> > +			goto got_task;
> 
> Since idle_balance() won't happen in the loop, may be we could use:
> 
> 	if p && p->sched_class == class
> 		return p
> 
> in here, let it fall down into the loop if p is idle, since that means
> we got RT/DL and will do this anyway, could save two jump work may be?
> (and may could combine some code below if so?)

Maybe; we'd have to look at whatever GCC does with it. But yes I think I
like the code better that way.


  reply	other threads:[~2014-02-17 11:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14  4:54 [RFC PATCH] sched: make sure sched-priority after invoke idle_balance() Michael wang
2014-02-14 12:38 ` Peter Zijlstra
2014-02-17  3:31   ` Michael wang
2014-02-17 11:24     ` Peter Zijlstra [this message]
2014-02-18  2:42       ` Michael 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=20140217112420.GD15586@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=juri.lelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=wangyun@linux.vnet.ibm.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