Re: [patch] cpusets: allow PF_THREAD_BOUND kworkers to escape froma cpuset

From: Li Zefan
Date: Fri Sep 23 2011 - 02:59:48 EST


cc David, who added this restriction

ä 2011å09æ23æ 14:21, Mike Galbraith wrote:
>
> kworkers can be born in a cpuset, leaving them adrift on an unsinkable ship.
> Allow them to be moved to the root cpuset so the cpuset can be destroyed.
>
> Signed-off-by: Mike Galbraith <efault@xxxxxx>
>

I've noticed this long ago, so..

Acked-by: Li Zefan <lizf@xxxxxxxxxxxxxx>

> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> index 10131fd..b26f4c4 100644
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -1384,7 +1384,7 @@ static int cpuset_can_attach(struct cgroup_subsys *ss, struct cgroup *cont,
> * set_cpus_allowed_ptr() on all attached tasks before cpus_allowed may
> * be changed.
> */
> - if (tsk->flags & PF_THREAD_BOUND)
> + if (tsk->flags & PF_THREAD_BOUND && cont->parent)

To make the code more self-explanatory, I think this is a bit better:

if (... && cont != cont->top_cgroup)

> return -EINVAL;
>
> return 0;
>
--
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/