Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

workqueue: wake up a worker when a rescuer is leaving a gcwq

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

Tejun Heo 7576958a 795abaf1

+9
+9
kernel/workqueue.c
··· 2047 2047 move_linked_works(work, scheduled, &n); 2048 2048 2049 2049 process_scheduled_works(rescuer); 2050 + 2051 + /* 2052 + * Leave this gcwq. If keep_working() is %true, notify a 2053 + * regular worker; otherwise, we end up with 0 concurrency 2054 + * and stalling the execution. 2055 + */ 2056 + if (keep_working(gcwq)) 2057 + wake_up_worker(gcwq); 2058 + 2050 2059 spin_unlock_irq(&gcwq->lock); 2051 2060 } 2052 2061