diff options
author | Lai Jiangshan <laijs@linux.alibaba.com> | 2020-05-29 08:58:59 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2020-05-29 16:22:10 +0200 |
commit | 4f3f4cf388f8fda7ee8ea7c6af0ff0ebb2d05fe4 (patch) | |
tree | 5fc7fd3791176131cb4c8a6b01b47188cc723bd2 /kernel/workqueue.c | |
parent | workqueue: Convert the pool::lock and wq_mayday_lock to raw_spinlock_t (diff) | |
download | linux-4f3f4cf388f8fda7ee8ea7c6af0ff0ebb2d05fe4.tar.xz linux-4f3f4cf388f8fda7ee8ea7c6af0ff0ebb2d05fe4.zip |
workqueue: void unneeded requeuing the pwq in rescuer thread
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 <laijs@linux.alibaba.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 82f85f5d81a8..6feefc65d332 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -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 |