From: Mikulas Patocka Date: Thu, 23 Mar 2023 15:25:49 +0000 (-0400) Subject: dm bufio: use waitqueue_active in __free_buffer_wake X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f5f93541202f2e619c1395f5d98868b70cf60f50;p=linux.git dm bufio: use waitqueue_active in __free_buffer_wake 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 Signed-off-by: Mike Snitzer --- diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index e5459741335d6..cca43ed13fd18 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -1665,7 +1665,12 @@ static void __free_buffer_wake(struct dm_buffer *b) 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)