Re: [PATCH REPOST v3.9-rc1] sched: replace PF_THREAD_BOUND withPF_NO_SETAFFINITY

From: Ingo Molnar
Date: Mon Mar 18 2013 - 05:41:50 EST

* Tejun Heo <tj@xxxxxxxxxx> wrote:

> PF_THREAD_BOUND was originally used to mark kernel threads which were
> bound to a specific CPU using kthread_bind() and a task with the flag
> set allows cpus_allowed modifications only to itself. Workqueue is
> currently abusing it to prevent userland from meddling with
> cpus_allowed of workqueue workers.
> What we need is a flag to prevent userland from messing with
> cpus_allowed of certain kernel tasks. In kernel, anyone can
> (incorrectly) squash the flag, and, for worker-type usages,
> restricting cpus_allowed modification to the task itself doesn't
> provide meaningful extra proection as other tasks can inject work
> items to the task anyway.
> This patch replaces PF_THREAD_BOUND with PF_NO_SETAFFINITY.
> sched_setaffinity() checks the flag and return -EINVAL if set.
> set_cpus_allowed_ptr() is no longer affected by the flag.
> This will allow simplifying workqueue worker CPU affinity management.

Acked-by: Ingo Molnar <mingo@xxxxxxxxxx>

I suspect you want to carry this in the workqueue tree, to enable those
extra simplifications?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at