[dm-devel] [PATCH] dm-bufio: use waitqueue_active in __free_buffer_wake
Mikulas Patocka
mpatocka at redhat.com
Thu Mar 23 15:25:49 UTC 2023
Save one spinlock by using waitqueue_active. We hold the bufio lock at
this place, so no one can add entries to the waitqueue at this point.
Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
---
drivers/md/dm-bufio.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: linux-2.6/drivers/md/dm-bufio.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-bufio.c
+++ linux-2.6/drivers/md/dm-bufio.c
@@ -1667,7 +1667,12 @@ static void __free_buffer_wake(struct dm
c->need_reserved_buffers--;
}
- wake_up(&c->free_buffer_wait);
+ /*
+ * We hold the bufio lock here, so no one can add entries to the
+ * wait queue anyway.
+ */
+ if (unlikely(waitqueue_active(&c->free_buffer_wait)))
+ wake_up(&c->free_buffer_wait);
}
static enum evict_result cleaned(struct dm_buffer *b, void *context)
More information about the dm-devel
mailing list