Re: [PATCH 02/12] workqueue: disallow set_cpus_allowed_ptr() fromwork item

From: Tejun Heo
Date: Wed Sep 26 2012 - 14:12:25 EST


On Thu, Sep 27, 2012 at 01:20:33AM +0800, Lai Jiangshan wrote:
> workers depend on local-wake-up, if a work function change its CPU, it will
> corrupt workqueue, disallow this behavior.
>
> When set_cpus_allowed_ptr() is called from workqueue.c in worker_thread(),
> we clear the PF_WQ_WORKER before set_cpus_allowed_ptr() and set it back
> after. (rescuer thread has no PF_WQ_WORKER, skip this behavior)
>
> It prevents other/future BUGs like https://bugzilla.kernel.org/show_bug.cgi?id=47301.

Hmmm... maybe. We better clear up PF_THREAD_BOUND semantics first
tho.

I think the two possible choices are,

* Don't allow set_cpus_allowed_ptr() at all and make the caller
responsible for turning it off if it explicitly wants to change
cpus_allowed.

* Don't allow changing affinity from userland.

Peter, Thomas?

--
tejun
--
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/