Messages in this thread Patch in this message | | | From | Lai Jiangshan <> | Subject | [RFC PATCH 8/8] workqueue: Move the locking out of maybe_create_worker() | Date | Thu, 4 Aug 2022 16:41:35 +0800 |
| |
From: Lai Jiangshan <jiangshan.ljs@antgroup.com>
The code is cleaner if the reversed pair of unlock() and lock() is moved into the caller.
Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com> --- kernel/workqueue.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 0d9844b81482..013ad61e67b9 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2091,17 +2091,10 @@ static void pool_mayday_timeout(struct timer_list *t) * sent to all rescuers with works scheduled on @pool to resolve * possible allocation deadlock. * - * LOCKING: - * raw_spin_lock_irq(pool->lock) which may be released and regrabbed - * multiple times. Does GFP_KERNEL allocations. Called only from - * manager. + * Does GFP_KERNEL allocations. Called only from manager. */ static void maybe_create_worker(struct worker_pool *pool) -__releases(&pool->lock) -__acquires(&pool->lock) { - raw_spin_unlock_irq(&pool->lock); - /* if we don't make progress in MAYDAY_INITIAL_TIMEOUT, call for help */ mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INITIAL_TIMEOUT); @@ -2116,7 +2109,6 @@ __acquires(&pool->lock) } del_timer_sync(&pool->mayday_timer); - raw_spin_lock_irq(&pool->lock); } /** @@ -2147,7 +2139,9 @@ static bool manage_workers(struct worker *worker) pool->flags |= POOL_MANAGER_ACTIVE; pool->manager = worker; + raw_spin_unlock_irq(&pool->lock); maybe_create_worker(pool); + raw_spin_lock_irq(&pool->lock); pool->manager = NULL; pool->flags &= ~POOL_MANAGER_ACTIVE; -- 2.19.1.6.gb485710b
| |