]> Git Repo - linux.git/commitdiff
workqueue: void unneeded requeuing the pwq in rescuer thread
authorLai Jiangshan <[email protected]>
Fri, 29 May 2020 06:58:59 +0000 (06:58 +0000)
committerTejun Heo <[email protected]>
Fri, 29 May 2020 14:22:10 +0000 (10:22 -0400)
008847f66c3 ("workqueue: allow rescuer thread to do more work.") made
the rescuer worker requeue the pwq immediately if there may be more
work items which need rescuing instead of waiting for the next mayday
timer expiration.  Unfortunately, it checks only whether the pool needs
help from rescuers, but it doesn't check whether the pwq has work items
in the pool (the real reason that this rescuer can help for the pool).

The patch adds the check and void unneeded requeuing.

Signed-off-by: Lai Jiangshan <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
kernel/workqueue.c

index 82f85f5d81a825eeb3f00d90453ffe24850c8f6d..6feefc65d3324c6e704f4a84e4a72fcb2385b3cf 100644 (file)
@@ -2530,7 +2530,7 @@ repeat:
                         * being used to relieve memory pressure, don't
                         * incur MAYDAY_INTERVAL delay inbetween.
                         */
-                       if (need_to_create_worker(pool)) {
+                       if (pwq->nr_active && need_to_create_worker(pool)) {
                                raw_spin_lock(&wq_mayday_lock);
                                /*
                                 * Queue iff we aren't racing destruction
This page took 0.082548 seconds and 4 git commands to generate.