Re: [PATCH 04/10] workqueue: don't set the worker's cpumask when kthread_bind_mask()

From: Tejun Heo
Date: Wed Dec 16 2020 - 09:40:22 EST


On Mon, Dec 14, 2020 at 11:54:51PM +0800, Lai Jiangshan wrote:
> @@ -1945,7 +1945,15 @@ static struct worker *create_worker(struct worker_pool *pool)
> goto fail;
>
> set_user_nice(worker->task, pool->attrs->nice);
> - kthread_bind_mask(worker->task, pool->attrs->cpumask);
> +
> + /*
> + * Set PF_NO_SETAFFINITY via kthread_bind_mask(). We use
> + * cpu_possible_mask other than pool->attrs->cpumask, because
^
instead of

> + * there might be no online cpu in the pool->attrs->cpumask.
^
might not be any

> + * The cpumask of the worker will be set properly later in
> + * worker_attach_to_pool().
> + */
> + kthread_bind_mask(worker->task, cpu_possible_mask);

This is a bit ugly but not the end of the world. Maybe we can move it to the
start of worker_thread() but that'd require an extra handshake. Oh well...

Thanks.

--
tejun