From: Zhaoyang Huang Date: Fri, 7 Feb 2025 09:19:42 +0000 (+0800) Subject: loop: release the lo_work_lock before queue_work X-Git-Tag: v6.15-rc1~166^2~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bee991f2b68175c828dc3f9c26367fe1827319a;p=thirdparty%2Flinux.git loop: release the lo_work_lock before queue_work queue_work could spin on wq->cpu_pwq->pool->lock which could lead to concurrent loop_process_work failed on lo_work_lock contention and increase the request latency. Remove this combination by moving the lock release ahead of queue_work. Signed-off-by: Zhaoyang Huang Link: https://lore.kernel.org/r/20250207091942.3966756-1-zhaoyang.huang@unisoc.com Signed-off-by: Jens Axboe --- diff --git a/drivers/block/loop.c b/drivers/block/loop.c index c05fe27a96b64..68c943a77e410 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -894,8 +894,8 @@ queue_work: cmd_list = &lo->rootcg_cmd_list; } list_add_tail(&cmd->list_entry, cmd_list); - queue_work(lo->workqueue, work); spin_unlock_irq(&lo->lo_work_lock); + queue_work(lo->workqueue, work); } static void loop_set_timer(struct loop_device *lo)