Skip to content

Commit ca10d85

Browse files
Waiman-Longhtejun
authored andcommitted
workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()
Commit 5c0338c ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered") enabled implicit ordered attribute to be added to WQ_UNBOUND workqueues with max_active of 1. This prevented the changing of attributes to these workqueues leading to fix commit 0a94efb ("workqueue: implicit ordered attribute should be overridable"). However, workqueue_apply_unbound_cpumask() was not updated at that time. So sysfs changes to wq_unbound_cpumask has no effect on WQ_UNBOUND workqueues with implicit ordered attribute. Since not all WQ_UNBOUND workqueues are visible on sysfs, we are not able to make all the necessary cpumask changes even if we iterates all the workqueue cpumasks in sysfs and changing them one by one. Fix this problem by applying the corresponding change made to apply_workqueue_attrs_locked() in the fix commit to workqueue_apply_unbound_cpumask(). Fixes: 5c0338c ("workqueue: restore WQ_UNBOUND/max_active==1 to be ordered") Signed-off-by: Waiman Long <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 7b42f40 commit ca10d85

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/workqueue.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5792,9 +5792,13 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask)
57925792
list_for_each_entry(wq, &workqueues, list) {
57935793
if (!(wq->flags & WQ_UNBOUND))
57945794
continue;
5795+
57955796
/* creating multiple pwqs breaks ordering guarantee */
5796-
if (wq->flags & __WQ_ORDERED)
5797-
continue;
5797+
if (!list_empty(&wq->pwqs)) {
5798+
if (wq->flags & __WQ_ORDERED_EXPLICIT)
5799+
continue;
5800+
wq->flags &= ~__WQ_ORDERED;
5801+
}
57985802

57995803
ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs, unbound_cpumask);
58005804
if (IS_ERR(ctx)) {

0 commit comments

Comments
 (0)