]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
workqueue: fix worker management invocation without pending works
authorTejun Heo <tj@kernel.org>
Fri, 2 Jul 2010 08:03:51 +0000 (10:03 +0200)
committerTejun Heo <tj@kernel.org>
Fri, 2 Jul 2010 08:03:51 +0000 (10:03 +0200)
When there's no pending work to do, worker_thread() goes back to sleep
after waking up without checking whether worker management is
necessary.  This means that idle worker exit requests can be ignored
if the gcwq stays empty.

Fix it by making worker_thread() always check whether worker
management is necessary before going to sleep.

Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index 0c485a5380990d9b2d354cbf7674cbbd36d41f97..2eb9fbddf5c6be2c98b2d15df50df668a1faebc6 100644 (file)
@@ -1832,10 +1832,10 @@ recheck:
        } while (keep_working(gcwq));
 
        worker_set_flags(worker, WORKER_PREP, false);
-
+sleep:
        if (unlikely(need_to_manage_workers(gcwq)) && manage_workers(worker))
                goto recheck;
-sleep:
+
        /*
         * gcwq->lock is held and there's no work to process and no
         * need to manage, sleep.  Workers are woken up only while