[PATCH 1/4] workqueue: Make wq_affn_dfl_set() use wq_online_cpumask

From: Tejun Heo
Date: Fri Aug 02 2024 - 17:19:13 EST


Other unbound pwq update paths are already using wq_online_cpumask which is
protected by wq_pool_mutex. Make wq_affn_dfl_set() to use wq_online_cpumask
too for synchronization and consistency.

Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
---
kernel/workqueue.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d56bd2277e58..6571e1f3c835 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -6909,18 +6909,16 @@ static int wq_affn_dfl_set(const char *val, const struct kernel_param *kp)
if (affn == WQ_AFFN_DFL)
return -EINVAL;

- cpus_read_lock();
mutex_lock(&wq_pool_mutex);

wq_affn_dfl = affn;

list_for_each_entry(wq, &workqueues, list) {
- for_each_online_cpu(cpu)
+ for_each_cpu(cpu, wq_online_cpumask)
unbound_wq_update_pwq(wq, cpu);
}

mutex_unlock(&wq_pool_mutex);
- cpus_read_unlock();

return 0;
}
--
2.45.2