Messages in this thread Patch in this message | | | From | Lai Jiangshan <> | Subject | [PATCH 04/10] workqueue: don't set the worker's cpumask when kthread_bind_mask() | Date | Mon, 14 Dec 2020 23:54:51 +0800 |
| |
From: Lai Jiangshan <laijs@linux.alibaba.com>
There might be no online cpu in the pool->attrs->cpumask. We will set the worker's cpumask later in worker_attach_to_pool().
Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com> --- kernel/workqueue.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 1f6cb83e0bc5..f679c599a70b 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -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 + * there might be no online cpu in the pool->attrs->cpumask. + * The cpumask of the worker will be set properly later in + * worker_attach_to_pool(). + */ + kthread_bind_mask(worker->task, cpu_possible_mask); /* successful, attach the worker to the pool */ worker_attach_to_pool(worker, pool); -- 2.19.1.6.gb485710b
| |