Skip to content

Commit 7b05c90

Browse files
Lai Jiangshanhtejun
authored andcommitted
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>
1 parent 99ed6f6 commit 7b05c90

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

kernel/workqueue.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,6 +3442,10 @@ static bool assign_rescuer_work(struct pool_workqueue *pwq, struct worker *rescu
34423442
struct worker_pool *pool = pwq->pool;
34433443
struct work_struct *work, *n;
34443444

3445+
/* need rescue? */
3446+
if (!pwq->nr_active || !need_to_create_worker(pool))
3447+
return false;
3448+
34453449
/*
34463450
* Slurp in all works issued via this workqueue and
34473451
* process'em.

0 commit comments

Comments
 (0)