[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230720094555.1397621-7-chengming.zhou@linux.dev>
Date: Thu, 20 Jul 2023 17:45:55 +0800
From: chengming.zhou@...ux.dev
To: axboe@...nel.dk, osandov@...com, ming.lei@...hat.com,
kbusch@...nel.org, krisman@...e.de
Cc: linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
zhouchengming@...edance.com
Subject: [PATCH 6/6] sbitmap: check ws_active before check waitqueues
From: Chengming Zhou <zhouchengming@...edance.com>
When !ws_active, we don't need to check waitqueues at all. So add
this check in sbitmap_queue_wake_all(), like we do in
sbitmap_queue_wake_up().
Signed-off-by: Chengming Zhou <zhouchengming@...edance.com>
---
lib/sbitmap.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index 6778ab3fc6a5..38c265e4ef9d 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -672,6 +672,10 @@ void sbitmap_queue_wake_all(struct sbitmap_queue *sbq)
* sbitmap_queue_wake_up().
*/
smp_mb();
+
+ if (!atomic_read(&sbq->ws_active))
+ return;
+
wake_index = READ_ONCE(sbq->wake_index);
for (i = 0; i < SBQ_WAIT_QUEUES; i++) {
struct sbq_wait_state *ws = &sbq->ws[wake_index];
--
2.41.0
Powered by blists - more mailing lists