OSDN Git Service

workqueue: remove the empty check in too_many_workers()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 3 Jun 2014 07:32:07 +0000 (15:32 +0800)
committerTejun Heo <tj@kernel.org>
Thu, 19 Jun 2014 16:24:40 +0000 (12:24 -0400)
commite6a9a7712331b9d2f551cad8630f6a6c6428c721
tree6cb4d8afd070d1300601596163c3cfbfcc638bd6
parent61d0fbb4b6f707d57555c9dc6d8a69144e0e8641
workqueue: remove the empty check in too_many_workers()

The commit ea1abd6197d5 ("workqueue: reimplement idle worker rebinding")
used a trick which simply removes all to-be-bound idle workers from the
idle list and lets them add themselves back after completing rebinding.

And this trick caused the @worker_pool->nr_idle may deviate than the actual
number of idle workers on @worker_pool->idle_list.  More specifically,
nr_idle may be non-zero while ->idle_list is empty.  All users of
->nr_idle and ->idle_list are audited.  The only affected one is
too_many_workers() which is updated to check %false if ->idle_list is
empty regardless of ->nr_idle.

The commit/trick was complicated due to it just tried to simplify an even
more complicated problem (workers had to rebind itself). But the commit
a9ab775bcadf ("workqueue: directly restore CPU affinity of workers
from CPU_ONLINE") fixed all these problems and the mentioned trick was
useless and is gone.

So, now the @worker_pool->nr_idle is exactly the actual number of workers
on @worker_pool->idle_list. too_many_workers() should recover as it was
before the trick. So we remove the empty check.

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