Skip to content

Commit

Permalink
workqueue: wake up a worker when a rescuer is leaving a gcwq
Browse files Browse the repository at this point in the history
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>
Cc: stable@kernel.org
  • Loading branch information
Tejun Heo committed Feb 14, 2011
1 parent 795abaf commit 7576958
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -2047,6 +2047,15 @@ static int rescuer_thread(void *__wq)
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);
}

Expand Down

0 comments on commit 7576958

Please sign in to comment.