Messages in this thread | | | From | Lai Jiangshan <> | Date | Fri, 5 Aug 2022 10:43:07 +0800 | Subject | Re: [RFC PATCH v3 1/3] workqueue: Hold wq_pool_mutex while affining tasks to wq_unbound_cpumask |
| |
On Thu, Aug 4, 2022 at 7:40 PM Valentin Schneider <vschneid@redhat.com> wrote: > > On 03/08/22 11:40, Lai Jiangshan wrote: > > On 2022/8/2 16:41, Valentin Schneider wrote: > >> When unbind_workers() reads wq_unbound_cpumask to set the affinity of > >> freshly-unbound kworkers, it only holds wq_pool_attach_mutex. This isn't > >> sufficient as wq_unbound_cpumask is only protected by wq_pool_mutex. > >> > >> This is made more obvious as of recent commit > >> > >> 46a4d679ef88 ("workqueue: Avoid a false warning in unbind_workers()") > >> > >> e.g. > >> > >> unbind_workers() workqueue_set_unbound_cpumask() > >> kthread_set_per_cpu(p, -1); > >> if (cpumask_intersects(wq_unbound_cpumask, cpu_active_mask)) > >> cpumask_copy(wq_unbound_cpumask, cpumask); > >> WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, wq_unbound_cpumask) < 0); > >> > >> Make workqueue_offline_cpu() invoke unbind_workers() with wq_pool_mutex > >> held. > > > > I would prefer to protect wq_unbound_cpumask with wq_pool_attach_mutex. > > That looks alright to me, do you want to push that separately as it's a > standalone patch, or should I carry it with this series? >
I'm Okay with both.
It needs review from Tejun. If Tejun has not queued it before you send a new update of this series, I will be glad if you carry it.
| |