History

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.

Lai Jiangshan committed 11 months ago

Commit fc5ff531 parent c2f2b011 file · +3 −10Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+3−10
@@ -2976,9 +2976,8 @@ static void idle_cull_fn(struct work_struct *work) · 2975 unmodified lines
2976 reap_dying_workers(&cull_list);2976 reap_dying_workers(&cull_list);
2977}2977}
2978 2978
2979static void send_mayday(struct work_struct *work)2979static void send_mayday(struct pool_workqueue *pwq)
2980{2980{
2981 struct pool_workqueue *pwq = get_work_pwq(work);
2982 struct workqueue_struct *wq = pwq->wq;2981 struct workqueue_struct *wq = pwq->wq;
2983 2982
2984 lockdep_assert_held(&wq_mayday_lock);2983 lockdep_assert_held(&wq_mayday_lock);
@@ -3016,7 +3015,7 @@ static void pool_mayday_timeout(struct timer_list *t) · 31 unmodified lines
3016 * rescuers.3015 * rescuers.
3017 */3016 */
3018 list_for_each_entry(work, &pool->worklist, entry)3017 list_for_each_entry(work, &pool->worklist, entry)
3019 send_mayday(work);3018 send_mayday(get_work_pwq(work));
3020 }3019 }
3021 3020
3022 raw_spin_unlock(&wq_mayday_lock);3021 raw_spin_unlock(&wq_mayday_lock);
@@ -3538,13 +3537,7 @@ repeat: · 515 unmodified lines
3538 */3537 */
3539 if (pwq->nr_active && need_to_create_worker(pool)) {3538 if (pwq->nr_active && need_to_create_worker(pool)) {
3540 raw_spin_lock(&wq_mayday_lock);3539 raw_spin_lock(&wq_mayday_lock);
3541 /*3540 send_mayday(pwq);
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 }
3548 raw_spin_unlock(&wq_mayday_lock);3541 raw_spin_unlock(&wq_mayday_lock);
3549 }3542 }
3550 }3543 }