1 From aac8a59537dfc704ff344f1aacfd143c089ee20f Mon Sep 17 00:00:00 2001
2 From: Tejun Heo <tj@kernel.org>
3 Date: Mon, 5 Feb 2024 15:43:41 -1000
4 Subject: Revert "workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()"
6 From: Tejun Heo <tj@kernel.org>
8 commit aac8a59537dfc704ff344f1aacfd143c089ee20f upstream.
10 This reverts commit ca10d851b9ad0338c19e8e3089e24d565ebfffd7.
12 The commit allowed workqueue_apply_unbound_cpumask() to clear __WQ_ORDERED
13 on now removed implicitly ordered workqueues. This was incorrect in that
14 system-wide config change shouldn't break ordering properties of all
15 workqueues. The reason why apply_workqueue_attrs() path was allowed to do so
16 was because it was targeting the specific workqueue - either the workqueue
17 had WQ_SYSFS set or the workqueue user specifically tried to change
18 max_active, both of which indicate that the workqueue doesn't need to be
21 The implicitly ordered workqueue promotion was removed by the previous
22 commit 3bc1e711c26b ("workqueue: Don't implicitly make UNBOUND workqueues w/
23 @max_active==1 ordered"). However, it didn't update this path and broke
24 build. Let's revert the commit which was incorrect in the first place which
27 Signed-off-by: Tejun Heo <tj@kernel.org>
28 Fixes: 3bc1e711c26b ("workqueue: Don't implicitly make UNBOUND workqueues w/ @max_active==1 ordered")
29 Fixes: ca10d851b9ad ("workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()")
30 Cc: stable@vger.kernel.org # v6.6+
31 Signed-off-by: Tejun Heo <tj@kernel.org>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34 kernel/workqueue.c | 8 ++------
35 1 file changed, 2 insertions(+), 6 deletions(-)
37 --- a/kernel/workqueue.c
38 +++ b/kernel/workqueue.c
39 @@ -5793,13 +5793,9 @@ static int workqueue_apply_unbound_cpuma
40 list_for_each_entry(wq, &workqueues, list) {
41 if (!(wq->flags & WQ_UNBOUND))
44 /* creating multiple pwqs breaks ordering guarantee */
45 - if (!list_empty(&wq->pwqs)) {
46 - if (wq->flags & __WQ_ORDERED_EXPLICIT)
48 - wq->flags &= ~__WQ_ORDERED;
50 + if (wq->flags & __WQ_ORDERED)
53 ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs, unbound_cpumask);