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 <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
This commit is contained in:
Mikulas Patocka 2023-03-23 11:25:49 -04:00 committed by Mike Snitzer
parent 530f683ddc
commit f5f9354120
1 changed files with 6 additions and 1 deletions

View File

@ -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)