[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200529065903.1758-2-laijs@linux.alibaba.com>
Date: Fri, 29 May 2020 06:58:59 +0000
From: Lai Jiangshan <laijs@...ux.alibaba.com>
To: linux-kernel@...r.kernel.org
Cc: Lai Jiangshan <laijs@...ux.alibaba.com>, Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: [PATCH 1/4] 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@...ux.alibaba.com>
---
kernel/workqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7a1fc9fe6314..b2b15f1f0c8d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2529,7 +2529,7 @@ static int rescuer_thread(void *__rescuer)
* 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)) {
spin_lock(&wq_mayday_lock);
/*
* Queue iff we aren't racing destruction
--
2.20.1
Powered by blists - more mailing lists