[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201218170919.2950-2-jiangshanlai@gmail.com>
Date: Sat, 19 Dec 2020 01:09:10 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Valentin Schneider <valentin.schneider@....com>,
Peter Zijlstra <peterz@...radead.org>,
Qian Cai <cai@...hat.com>,
Vincent Donnefort <vincent.donnefort@....com>,
Lai Jiangshan <laijs@...ux.alibaba.com>,
Hillf Danton <hdanton@...a.com>, Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: [PATCH -tip V2 01/10] workqueue: restore unbound_workers' cpumask correctly
From: Lai Jiangshan <laijs@...ux.alibaba.com>
When we restore workers' cpumask, we should restore them to the
designed pool->attrs->cpumask. And we need to only do it at
the first time.
Cc: Hillf Danton <hdanton@...a.com>
Reported-by: Hillf Danton <hdanton@...a.com>
Acked-by: Tejun Heo <tj@...nel.org>
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
kernel/workqueue.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c71da2a59e12..aba71ab359dd 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5031,9 +5031,13 @@ static void restore_unbound_workers_cpumask(struct worker_pool *pool, int cpu)
cpumask_and(&cpumask, pool->attrs->cpumask, cpu_online_mask);
+ /* is @cpu the first one onlined for the @pool? */
+ if (cpumask_weight(&cpumask) > 1)
+ return;
+
/* as we're called from CPU_ONLINE, the following shouldn't fail */
for_each_pool_worker(worker, pool)
- WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, &cpumask) < 0);
+ WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask) < 0);
}
int workqueue_prepare_cpu(unsigned int cpu)
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists