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

From: Rakib Mullick
Date: Wed Oct 20 2010 - 00:13:26 EST


On Tue, Oct 19, 2010 at 8:40 PM, Rakib Mullick <rakib.mullick@xxxxxxxxx> wrote:
> On 10/19/10, Gregory Haskins <ghaskins@xxxxxxxxxx> wrote:
>>>>> On 10/19/2010 at 07:02 AM, in message <1287486167.1994.1.camel@twins>,
>>>>> Peter
>> Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>>> On Tue, 2010-10-19 at 16:57 +0600, Rakib Mullick wrote:
>>
> If we made explicit check before calling find_lowest_rq, then I don't
> think we need the change that Steve's suggesting. I think explicitly
> checking is much more easier and removes extra overhead of function
> calling.

The following patch shows what I was trying to say. Please check and
comment. Hopefully this looks clean.


--- linus-rc8/kernel/sched_rt.c 2010-10-19 16:42:05.000000000 +0600
+++ rakib-rc8/kernel/sched_rt.c 2010-10-20 10:04:08.000000000 +0600
@@ -1174,9 +1174,6 @@ static int find_lowest_rq(struct task_st
int this_cpu = smp_processor_id();
int cpu = task_cpu(task);

- if (task->rt.nr_cpus_allowed == 1)
- return -1; /* No other targets possible */
-
if (!cpupri_find(&task_rq(task)->rd->cpupri, task, lowest_mask))
return -1; /* No targets found */

@@ -1238,6 +1235,9 @@ static struct rq *find_lock_lowest_rq(st
int tries;
int cpu;

+ if (task->rt.nr_cpus_allowed < 2)
+ goto out;
+
for (tries = 0; tries < RT_MAX_TRIES; tries++) {
cpu = find_lowest_rq(task);

@@ -1275,6 +1275,7 @@ static struct rq *find_lock_lowest_rq(st
lowest_rq = NULL;
}

+out:
return lowest_rq;
}



Thanks,
Rakib

>
> Thanks,
> Rakib
>> Kind Regards,
>> -Greg
>>
>>
>>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/