Re: [PATCH] workqueue: keep unbound rescuer's cpumask to be default cpumask

From: Tejun Heo
Date: Tue Jan 19 2021 - 11:08:31 EST


On Sat, Jan 16, 2021 at 02:57:53PM +0800, Lai Jiangshan wrote:
> From: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>
>
> When we attach a rescuer to a pool, we will set the rescuer's cpumask
> to the pool's cpumask. If there is hotplug ongoing, it may cause
> the rescuer running on the dying CPU and cause bug or it may cause
> warning of setting online&!active cpumask.
>
> So we have to find a reliable way to set cpumask when attaching
> rescuer.
>
> When the pool is percpu pool, we have easy way to reliably
> set cpumask with the help of %POOL_DISASSOCIATED.
>
> But when it is unbound rescuer, the problem becomes harder, because
> we can't neither use get_online_cpus() here nor test cpu_active_mask
> without synchronization.
>
> Atfer investigation, and noticing the unbound nature of the unbound
> rescuer, we decide to make it use the wq's default pwq's cpumask so
> that we don't need to set the rescuer's cpumask when attaching.
>
> To implement it, we have to set unbound rescuer's cpumask to the
> default pwq's cpumask when creation and maintain it when hotplug
> or the default pwq is changed.

Yeah, this approach makes sense to me. It doesn't look like all problems are
resolved but for the rescuer behavior part, please feel free to add

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Thanks.

--
tejun