Skip to content

Commit 35bdc19

Browse files
committed
Merge tag 'wq-for-7.0-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue fix from Tejun Heo: "This is a fix for a stall which triggers on ordered workqueues when there are multiple inactive work items during workqueue property changes through sysfs, which doesn't happen that frequently. While really late, the fix is very low risk as it just repeats an operation which is already being performed: - Fix incomplete activation of multiple inactive works when unplugging a pool_workqueue, where the pending_pwqs list wasn't being updated for subsequent works" * tag 'wq-for-7.0-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: Add pool_workqueue to pending_pwqs list when unplugging multiple inactive works
2 parents ab3dee2 + 703ccb6 commit 35bdc19

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

kernel/workqueue.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1849,8 +1849,20 @@ static void unplug_oldest_pwq(struct workqueue_struct *wq)
18491849
raw_spin_lock_irq(&pwq->pool->lock);
18501850
if (pwq->plugged) {
18511851
pwq->plugged = false;
1852-
if (pwq_activate_first_inactive(pwq, true))
1852+
if (pwq_activate_first_inactive(pwq, true)) {
1853+
/*
1854+
* While plugged, queueing skips activation which
1855+
* includes bumping the nr_active count and adding the
1856+
* pwq to nna->pending_pwqs if the count can't be
1857+
* obtained. We need to restore both for the pwq being
1858+
* unplugged. The first call activates the first
1859+
* inactive work item and the second, if there are more
1860+
* inactive, puts the pwq on pending_pwqs.
1861+
*/
1862+
pwq_activate_first_inactive(pwq, false);
1863+
18531864
kick_pool(pwq->pool);
1865+
}
18541866
}
18551867
raw_spin_unlock_irq(&pwq->pool->lock);
18561868
}

0 commit comments

Comments
 (0)