Re: [PATCH] sched: shorten setting the allowed cpu mask of task

From: Yong Zhang
Date: Mon May 09 2011 - 00:39:50 EST


On Fri, May 6, 2011 at 8:52 PM, Hillf Danton <dhillf@xxxxxxxxx> wrote:
> When setting the allowed cpu mask for a given task, if the task is
> already bound to certain cpu, after checking the validity of the new

Maybe we don't need to restrict it only on task bound to certain cpu.

> mask of allowed cpus, job is done, and no further efforts needed for
> the valid case as well.
>
> Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
> ---
>
> --- a/kernel/sched.c  Â2011-04-27 11:48:50.000000000 +0800
> +++ b/kernel/sched.c  Â2011-05-06 20:39:58.000000000 +0800
> @@ -5899,9 +5899,9 @@ again:
> Â Â Â Â Â Â Â Âgoto out;
> Â Â Â Â}
>
> - Â Â Â if (unlikely((p->flags & PF_THREAD_BOUND) && p != current &&
> - Â Â Â Â Â Â Â Â Â Â!cpumask_equal(&p->cpus_allowed, new_mask))) {
> - Â Â Â Â Â Â Â ret = -EINVAL;
> + Â Â Â if ((p->flags & PF_THREAD_BOUND) && p != current) {
> + Â Â Â Â Â Â Â if (!cpumask_equal(&p->cpus_allowed, new_mask))

IOW, we could make '!cpumask_equal(&p->cpus_allowed, new_mask)'
be a separated condition. And I don't see any potential problem with it.

Thanks,
Yong


> + Â Â Â Â Â Â Â Â Â Â Â ret = -EINVAL;
> Â Â Â Â Â Â Â Âgoto out;
> Â Â Â Â}
>



--
Only stand for myself
--
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/