lkml.org 
[lkml]   [2020]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 04/10] workqueue: don't set the worker's cpumask when kthread_bind_mask()
Date
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
\
 
 \ /
  Last update: 2020-12-14 16:03    [W:0.328 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site