workqueue: Skip __WQ_DESTROYING workqueues when updating global unbound cpumask
authorWaiman Long <longman@redhat.com>
Sat, 3 Feb 2024 15:43:30 +0000 (10:43 -0500)
committerTejun Heo <tj@kernel.org>
Mon, 5 Feb 2024 17:52:22 +0000 (07:52 -1000)
Skip updating workqueues with __WQ_DESTROYING bit set when updating
global unbound cpumask to avoid unnecessary work and other complications.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index d7fdb631ecf7d325b640c77057ad1204fce3464a..68c48489eab31ded8e924e226d1d54ab62c55ed3 100644 (file)
@@ -6501,7 +6501,7 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask)
        lockdep_assert_held(&wq_pool_mutex);
 
        list_for_each_entry(wq, &workqueues, list) {
-               if (!(wq->flags & WQ_UNBOUND))
+               if (!(wq->flags & WQ_UNBOUND) || (wq->flags & __WQ_DESTROYING))
                        continue;
 
                /* creating multiple pwqs breaks ordering guarantee */