]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
workqueue: wake up a worker when a rescuer is leaving a gcwq
authorTejun Heo <tj@kernel.org>
Mon, 14 Feb 2011 13:04:46 +0000 (14:04 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 24 Feb 2011 22:54:32 +0000 (14:54 -0800)
commit 7576958a9d5a4a677ad7dd40901cdbb6c1110c98 upstream.

After executing the matching works, a rescuer leaves the gcwq whether
there are more pending works or not.  This may decrease the
concurrency level to zero and stall execution until a new work item is
queued on the gcwq.

Make rescuer wake up a regular worker when it leaves a gcwq if there
are more works to execute, so that execution isn't stalled.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
kernel/workqueue.c

index 4be7fa5fe304aee093107e9c083e042b183d5c31..7a7ff509b551f4ebdae68370c02f780b986ccdfc 100644 (file)
@@ -2009,6 +2009,15 @@ repeat:
                                move_linked_works(work, scheduled, &n);
 
                process_scheduled_works(rescuer);
+
+               /*
+                * Leave this gcwq.  If keep_working() is %true, notify a
+                * regular worker; otherwise, we end up with 0 concurrency
+                * and stalling the execution.
+                */
+               if (keep_working(gcwq))
+                       wake_up_worker(gcwq);
+
                spin_unlock_irq(&gcwq->lock);
        }