[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201214155457.3430-5-jiangshanlai@gmail.com>
Date: Mon, 14 Dec 2020 23:54:51 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Lai Jiangshan <laijs@...ux.alibaba.com>,
Peter Zijlstra <peterz@...radead.org>,
Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: [PATCH 04/10] workqueue: don't set the worker's cpumask when kthread_bind_mask()
From: Lai Jiangshan <laijs@...ux.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@...radead.org>
Signed-off-by: Lai Jiangshan <laijs@...ux.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
Powered by blists - more mailing lists