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

From: Lai Jiangshan
Date: Thu Aug 08 2024 - 00:23:53 EST


Hello

On Sat, Aug 3, 2024 at 5:18 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
>
> 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);
> }

I think it should be for_each_possible_cpu() for updating the pwqs.

For all the 4 patches:

Reviewed-by: Lai Jiangshan <jiangshanlai@xxxxxxxxx>

Thanks
Lai