Re: [PATCH 2/2] workqueue: Fix affinity of kworkers attached during late hotplug

From: Peter Zijlstra
Date: Fri Dec 11 2020 - 07:52:53 EST


On Fri, Dec 11, 2020 at 11:39:21AM +0000, Vincent Donnefort wrote:
> On Thu, Dec 10, 2020 at 04:38:30PM +0000, Valentin Schneider wrote:
> > + if (pool->flags & POOL_DISASSOCIATED) {
> > worker->flags |= WORKER_UNBOUND;
> > + set_cpus_allowed_ptr(worker->task, cpu_active_mask);
> > + } else {
> > + /*
> > + * set_cpus_allowed_ptr() will fail if the cpumask doesn't have any
> > + * online CPUs. It'll be re-applied when any of the CPUs come up.
> > + */
>
> Does this comment still stand ? IIUC, we should always be in the
> POOL_DISASSOCIATED case if the CPU from cpumask is offline. Unless a
> pool->attrs->cpumask can have several CPUs. In that case maybe we should check
> for the cpu_active_mask here too ?

IIUC it can be a numa mask, and would still be valid in that case.

> > + set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
> > + }