From: Lai Jiangshan <la...@linux.alibaba.com> When we restore workers' cpumask, we should restore them to the designed pool->attrs->cpumask. And we need to only do it at the first time.
Cc: Hillf Danton <hdan...@sina.com> Reported-by: Hillf Danton <hdan...@sina.com> Acked-by: Tejun Heo <t...@kernel.org> Signed-off-by: Lai Jiangshan <la...@linux.alibaba.com> --- kernel/workqueue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c71da2a59e12..aba71ab359dd 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5031,9 +5031,13 @@ static void restore_unbound_workers_cpumask(struct worker_pool *pool, int cpu) cpumask_and(&cpumask, pool->attrs->cpumask, cpu_online_mask); + /* is @cpu the first one onlined for the @pool? */ + if (cpumask_weight(&cpumask) > 1) + return; + /* as we're called from CPU_ONLINE, the following shouldn't fail */ for_each_pool_worker(worker, pool) - WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, &cpumask) < 0); + WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask) < 0); } int workqueue_prepare_cpu(unsigned int cpu) -- 2.19.1.6.gb485710b