Messages in this thread | | | Date | Fri, 26 Aug 2022 14:33:51 -1000 | From | Tejun Heo <> | 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
| |