Re: [PATCH] sched_rt: Removes extra checking for nr_cpus_allowed when calling find_lowest_rq

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Rostedt
Date: Tuesday, October 19, 2010 - 5:38 am

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


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




--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] sched_rt: Removes extra checking for nr_cpus_a ..., Steven Rostedt, (Tue Oct 19, 5:38 am)