[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201226025117.2770-7-jiangshanlai@gmail.com>
Date: Sat, 26 Dec 2020 10:51:14 +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>,
Dexuan Cui <decui@...rosoft.com>,
Lai Jiangshan <laijs@...ux.alibaba.com>,
Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: [PATCH -tip V3 6/8] workqueue: reorganize workqueue_online_cpu()
From: Lai Jiangshan <laijs@...ux.alibaba.com>
Just move around the code, no functionality changed.
It prepares for later patch protecting wq_online_cpumask
in wq_pool_attach_mutex.
Acked-by: Tejun Heo <tj@...nel.org>
Signed-off-by: Lai Jiangshan <laijs@...ux.alibaba.com>
---
kernel/workqueue.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 79cc87df0cda..94545e6feda5 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5088,12 +5088,17 @@ int workqueue_online_cpu(unsigned int cpu)
mutex_lock(&wq_pool_mutex);
cpumask_set_cpu(cpu, wq_online_cpumask);
+ for_each_cpu_worker_pool(pool, cpu) {
+ mutex_lock(&wq_pool_attach_mutex);
+ rebind_workers(pool);
+ mutex_unlock(&wq_pool_attach_mutex);
+ }
+
+ /* update CPU affinity of workers of unbound pools */
for_each_pool(pool, pi) {
mutex_lock(&wq_pool_attach_mutex);
- if (pool->cpu == cpu)
- rebind_workers(pool);
- else if (pool->cpu < 0)
+ if (pool->cpu < 0)
update_unbound_workers_cpumask(pool, true, cpu);
mutex_unlock(&wq_pool_attach_mutex);
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists