* [dm-devel] [PATCH] dm-bufio: use waitqueue_active in __free_buffer_wake
@ 2023-03-23 15:25 Mikulas Patocka
0 siblings, 0 replies; only message in thread
From: Mikulas Patocka @ 2023-03-23 15:25 UTC (permalink / raw)
To: Joe Thornber, Mike Snitzer; +Cc: dm-devel
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@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)
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-23 15:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 15:25 [dm-devel] [PATCH] dm-bufio: use waitqueue_active in __free_buffer_wake Mikulas Patocka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).