]> git.karo-electronics.de Git - karo-tx-linux.git/commit
workqueue: fix possible idle worker depletion during CPU_ONLINE
authorTejun Heo <tj@kernel.org>
Thu, 6 Sep 2012 19:50:41 +0000 (12:50 -0700)
committerTejun Heo <tj@kernel.org>
Thu, 6 Sep 2012 19:50:41 +0000 (12:50 -0700)
commit985aafbf530834a9ab16348300adc7cbf35aab76
tree220a9b135de8ee33acac2de2521b54db802f172a
parent0150a04271dbcc9abbb2575911fa1d72d40451bf
workqueue: fix possible idle worker depletion during CPU_ONLINE

To simplify both normal and CPU hotplug paths, while CPU hotplug is in
progress, manager_mutex is held to prevent one of the workers from
becoming a manager and creating or destroying workers; unfortunately,
it currently may lead to idle worker depletion which in turn can lead
to deadlock under extreme circumstances.

Idle workers aren't allowed to become busy if there's no other idle
worker left to create more idle workers, but during CPU_ONLINE
gcwq_associate() is holding all managerships and all the idle workers
can proceed to become busy before gcwq_associate() is finished.

This patch fixes the bug by releasing manager_mutexes before letting
the rebound idle workers go.  This ensures that by the time idle
workers check whether management is necessary, CPU_ONLINE already has
released the positions.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Lai Jiangshan <laijs@cn.fujitsu.com>
kernel/workqueue.c