Re: workqueue: WARN at at kernel/workqueue.c:2176

From: Tejun Heo
Date: Fri May 16 2014 - 08:08:30 EST


Hello, Peter.

On Fri, May 16, 2014 at 01:57:37PM +0200, Peter Zijlstra wrote:
> This of course leaves the question how the workqueue code manages to
> call set_cpu_allowed_ptr() on a cpu _before_ its online.
>
> That too sounds fishy.. with the proposed patch the
> set_cpus_allowed_ptr() will 'gracefully' fail, but calling it in the
> first place is of course dubious too.

Right after being created, a workqueue worker invokes
set_cpus_allowed_ptr() to the target cpumask without checking whether
the cpu[s] are online or not and it's allowed to fail. The guarantee
there is that the worker is already registered by that point and if a
CPU comes online after the registration, CPU_ONLINE notification will
update the cpumask accordingly, so either way the worker is guaranteed
to be on the right cpumask.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/