[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZoWYPMGVIvOV4o8x@slm.duckdns.org>
Date: Wed, 3 Jul 2024 08:28:12 -1000
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <jiangshanlai@...il.com>
Cc: linux-kernel@...r.kernel.org,
Lai Jiangshan <jiangshan.ljs@...group.com>,
Waiman Long <longman@...hat.com>
Subject: Re: [PATCH 2/6] workqueue: Protect wq_unbound_cpumask with
wq_pool_attach_mutex in init_rescuer()
Hello, Lai.
On Wed, Jul 03, 2024 at 11:38:51AM +0800, Lai Jiangshan wrote:
> @@ -5533,6 +5533,9 @@ static int init_rescuer(struct workqueue_struct *wq)
> return ret;
> }
>
> + /* lock wq_pool_attach_mutex for wq_unbound_cpumask */
> + mutex_lock(&wq_pool_attach_mutex);
> +
> wq->rescuer = rescuer;
> if (wq->flags & WQ_UNBOUND)
> kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
> @@ -5540,6 +5543,8 @@ static int init_rescuer(struct workqueue_struct *wq)
> kthread_bind_mask(rescuer->task, cpu_possible_mask);
> wake_up_process(rescuer->task);
>
> + mutex_unlock(&wq_pool_attach_mutex);
> +
Isn't that just protecting the reads on wq_unbound_cpumask? I don't
understand what this protects against. Shouldn't the interlocking be
something like "either new rescuer reads the updated cpumask or the
workqueue is already on the workqueue list"?
Thanks.
--
tejun
Powered by blists - more mailing lists