Skip to content

Commit fc5ff53

Browse files
Lai Jiangshanhtejun
authored andcommitted
workqueue: Make send_mayday() take a PWQ argument directly
Make send_mayday() operate on a PWQ directly instead of taking a work item, so that rescuer_thread() now calls send_mayday(pwq) instead of open-coding the mayday list manipulation. Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent c2f2b01 commit fc5ff53

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

kernel/workqueue.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,9 +2976,8 @@ static void idle_cull_fn(struct work_struct *work)
29762976
reap_dying_workers(&cull_list);
29772977
}
29782978

2979-
static void send_mayday(struct work_struct *work)
2979+
static void send_mayday(struct pool_workqueue *pwq)
29802980
{
2981-
struct pool_workqueue *pwq = get_work_pwq(work);
29822981
struct workqueue_struct *wq = pwq->wq;
29832982

29842983
lockdep_assert_held(&wq_mayday_lock);
@@ -3016,7 +3015,7 @@ static void pool_mayday_timeout(struct timer_list *t)
30163015
* rescuers.
30173016
*/
30183017
list_for_each_entry(work, &pool->worklist, entry)
3019-
send_mayday(work);
3018+
send_mayday(get_work_pwq(work));
30203019
}
30213020

30223021
raw_spin_unlock(&wq_mayday_lock);
@@ -3538,13 +3537,7 @@ static int rescuer_thread(void *__rescuer)
35383537
*/
35393538
if (pwq->nr_active && need_to_create_worker(pool)) {
35403539
raw_spin_lock(&wq_mayday_lock);
3541-
/*
3542-
* Queue iff somebody else hasn't queued it already.
3543-
*/
3544-
if (list_empty(&pwq->mayday_node)) {
3545-
get_pwq(pwq);
3546-
list_add_tail(&pwq->mayday_node, &wq->maydays);
3547-
}
3540+
send_mayday(pwq);
35483541
raw_spin_unlock(&wq_mayday_lock);
35493542
}
35503543
}

0 commit comments

Comments
 (0)