On Tue, Dec 29, 2020 at 6:06 PM Hillf Danton <hdan...@sina.com> wrote: > > On Sat, 26 Dec 2020 10:51:16 +0800 > > From: Lai Jiangshan <la...@linux.alibaba.com> > > > > When worker_attach_to_pool() is called, we should not put the workers > > to pool->attrs->cpumask when there is not CPU online in it. > > > > We have to use wq_online_cpumask in worker_attach_to_pool() to check > > if pool->attrs->cpumask is valid rather than cpu_online_mask or > > cpu_active_mask due to gaps between stages in cpu hot[un]plug. > > In 5/8 pool->attrs->cpumask is not restored to avoid triggering > the warning added in e9d867a67fd03ccc ("sched: Allow > per-cpu kernel threads to run on online && !active"), is it likely > needed to repeat that trick here? > Is the above gap no longer existing here at the presence of > wq_online_cpumask?
It still exists. When online, wq_online_cpumask is always cpu_online_mask, no thing changed. An alternative way is to move the code into a work item, which adds the proper protection against cpu hotlug and does the work. I don't want to add too much complex in this patchset.