mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Rakib Mullick <rakib.mullick@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
	Gregory Haskins <ghaskins@novell.com>
Subject: Re: [PATCH] sched_rt: Removes extra checking for nr_cpus_allowed when calling find_lowest_rq
Date: Tue, 19 Oct 2010 08:38:51 -0400	[thread overview]
Message-ID: <1287491931.16971.358.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1287486167.1994.1.camel@twins>

On Tue, 2010-10-19 at 13:02 +0200, Peter Zijlstra wrote:

> > Remove the check for nr_cpus_allowed of an RT task before calling
> > find_lowest_cpu() from select_task_rq_rt function. Cause
> > find_lowest_cpu checks for rt.nr_cpus_allowed of a process.
> > It would've been nice, if we make the check before calling
> > find_lowest_cpu. But its called from other places, so keep the
> > nr_cpus_allowed check into find_lowest_cpu().
> 

Yes it is redundant, but I'm wondering if we should modify
find_lowest_rq() just to short cut this case.

That is, instead of assigning all the variables on the stack, which I'm
thinking __get_cpu_var() may act like a barrier() where gcc can't
optimize. We should probably also do the following:

static int find_lowest_rq(struct task_struct *task)
{
	struct sched_domain *sd;
-	struct cpumask *lowest_mask = __get_cpu_var(local_cpu_mask);
-	int this_cpu = smp_processor_id();
-	int cpu      = task_cpu(task);
+	struct cpumask *lowest_mask;
+	int this_cpu;
+	int cpu;

	if (task->rt.nr_cpus_allowed == 1)
		return -1; /* No other targets possible */

+	lowest_mask = __get_cpu_var(local_cpu_mask);
+	this_cpu = smp_processor_id();
+	cpu = task_cpu(task;


Then removing the redundant check may not hurt anything.

-- Steve


> > Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> > ---
> > 
> > --- linus-rc8/kernel/sched_rt.c	2010-10-15 05:26:43.000000000 +0600
> > +++ rakib-rc8/kernel/sched_rt.c	2010-10-19 16:22:30.000000000 +0600
> > @@ -971,8 +971,7 @@ select_task_rq_rt(struct rq *rq, struct
> >  	 * that is just being woken and probably will have
> >  	 * cold cache anyway.
> >  	 */
> > -	if (unlikely(rt_task(rq->curr)) &&
> > -	    (p->rt.nr_cpus_allowed > 1)) {
> > +	if (unlikely(rt_task(rq->curr))) {
> >  		int cpu = find_lowest_rq(p);
> > 
> >  		return (cpu == -1) ? task_cpu(p) : cpu;



  parent reply	other threads:[~2010-10-19 12:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 10:57 Rakib Mullick
2010-10-19 11:02 ` Peter Zijlstra
2010-10-19 11:12   ` Rakib Mullick
2010-10-19 12:38   ` Steven Rostedt [this message]
2010-10-19 12:57   ` Gregory Haskins
2010-10-19 13:01     ` Steven Rostedt
2010-10-19 13:07       ` Gregory Haskins
2010-10-19 14:40     ` Rakib Mullick
2010-10-20  4:13       ` Rakib Mullick

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=1287491931.16971.358.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=ghaskins@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rakib.mullick@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

all inboxes | Powered by JetHome®