Re: [PATCH v2 1/2] sched/rt: Check to push the task when changing its affinity

From: Xunlei Pang
Date: Sun Feb 08 2015 - 10:19:34 EST


On 8 February 2015 at 22:55, Xunlei Pang <pang.xunlei@xxxxxxxxxx> wrote:
> Hi Steve,
>
> On 7 February 2015 at 05:09, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>> On Thu, 5 Feb 2015 23:59:33 +0800
>>
>> if (task_running(rq, p)) {
>> if (cpumask_test_cpu() && cpupri_find()) {
>> }
>> } else {
>> direct push = 1
>>
>> Also, is the copy of cpus_allowed only done so that cpupri_find is
>> called? If so maybe move it in there too:
>>
>> if (task_running(rq, p)) {
>> if (!cpumask_test_cpu())
>> goto update;
>>
>> cpumask_copy(&p->cpus_allowed, new_mask);
>> p->nr_cpus_allowed = new_weight;
>>
>> if (!cpupri_find())
>> goto update;
>>
>> [...]
>>
>> This way we avoid the double copy of cpumask unless we truly need to do
>> it.
>
> The new_mask can also be used by direct_push case, so I think it's ok.

I guess you mean to avoid the copy if cpumask_test_cpu() is false.
I think this function is not the hot path, making this will make the code
indents too many times or not so good to look, a little awful.

Thanks,
Xunlei
--
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/