[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ywlmb1ADhHnfFUI8@slm.duckdns.org>
Date: Fri, 26 Aug 2022 14:33:51 -1000
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <jiangshanlai@...il.com>
Cc: linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <frederic@...nel.org>,
Juri Lelli <juri.lelli@...hat.com>,
Phil Auld <pauld@...hat.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
Lai Jiangshan <jiangshan.ljs@...group.com>,
Zqiang <qiang1.zhang@...el.com>
Subject: Re: [PATCH] workqueue: Protects wq_unbound_cpumask with
wq_pool_attach_mutex
Hello,
On Thu, Aug 18, 2022 at 10:33:48PM +0800, Lai Jiangshan wrote:
> @@ -5342,6 +5344,11 @@ static int workqueue_apply_unbound_cpumask(void)
> apply_wqattrs_cleanup(ctx);
> }
>
> + if (!ret) {
> + mutex_lock(&wq_pool_attach_mutex);
> + cpumask_copy(wq_unbound_cpumask, unbound_cpumask);
> + mutex_unlock(&wq_pool_attach_mutex);
Is this enough? Shouldn't the lock be protecting a wider scope? If there's
someone reading the flag with just pool_attach_mutex, what prevents them
reading it right before the new value is committed and keeps using the stale
value?
Thanks.
--
tejun
Powered by blists - more mailing lists