workqueue: Only assign rescuer work when really needed

If the pwq does not need rescue (normal workers have been created or
become available), the rescuer can immediately move on to other stalled
pwqs.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
Lai Jiangshan
2025-11-21 22:57:15 +08:00
committed by Tejun Heo
parent 99ed6f62a4
commit 7b05c90b33

View File

@@ -3442,6 +3442,10 @@ static bool assign_rescuer_work(struct pool_workqueue *pwq, struct worker *rescu
struct worker_pool *pool = pwq->pool;
struct work_struct *work, *n;
/* need rescue? */
if (!pwq->nr_active || !need_to_create_worker(pool))
return false;
/*
* Slurp in all works issued via this workqueue and
* process'em.