[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240704034915.2164-3-jiangshanlai@gmail.com>
Date: Thu, 4 Jul 2024 11:49:11 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Lai Jiangshan <jiangshan.ljs@...group.com>,
Juri Lelli <juri.lelli@...hat.com>,
Waiman Long <longman@...hat.com>,
Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>
Subject: [PATCH V2 2/5] workqueue: Make rescuer initialization as the last step of the creation of a new wq
From: Lai Jiangshan <jiangshan.ljs@...group.com>
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@...hat.com>
Cc: Waiman Long <longman@...hat.com>
Signed-off-by: Lai Jiangshan <jiangshan.ljs@...group.com>
---
kernel/workqueue.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 904a1a6808b7..0c5dc7c06b81 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5690,9 +5690,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
@@ -5708,6 +5705,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;
--
2.19.1.6.gb485710b
Powered by blists - more mailing lists