summaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLai Jiangshan <jiangshan.ljs@antgroup.com>2024-07-04 06:49:11 +0300
committerTejun Heo <tj@kernel.org>2024-07-05 22:14:40 +0300
commitc5178e6ca6c8063edc103b75f410add7e4565e63 (patch)
tree00c1422d3635fd30c807f8219d70b076245f87df /kernel/workqueue.c
parentc3138f3881920d1391e435aa4144b929d5237617 (diff)
downloadlinux-c5178e6ca6c8063edc103b75f410add7e4565e63.tar.xz
workqueue: Make rescuer initialization as the last step of the creation of a new wq
For early wq allocation, rescuer initialization is the last step of the creation of a new wq. Make the behavior the same for all allocations. Prepare for initializing rescuer's affinities with the default pwq's affinities. Prepare for moving the whole workqueue initializing procedure into wq_pool_mutex and cpu hotplug locks. Cc: Juri Lelli <juri.lelli@redhat.com> Cc: Waiman Long <longman@redhat.com> Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 5cb1dd0a49fb..af00e63182d0 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5681,9 +5681,6 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
if (alloc_and_link_pwqs(wq) < 0)
goto err_free_node_nr_active;
- if (wq_online && init_rescuer(wq) < 0)
- goto err_destroy;
-
/*
* wq_pool_mutex protects global freeze state and workqueues list.
* Grab it, adjust max_active and add the new @wq to workqueues
@@ -5699,6 +5696,9 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
mutex_unlock(&wq_pool_mutex);
+ if (wq_online && init_rescuer(wq) < 0)
+ goto err_destroy;
+
if ((wq->flags & WQ_SYSFS) && workqueue_sysfs_register(wq))
goto err_destroy;