diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2023-03-23 18:25:49 +0300 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-03-30 22:57:50 +0300 |
commit | f5f93541202f2e619c1395f5d98868b70cf60f50 (patch) | |
tree | 4e066e079bff797e5e2bf8204580c23a13549b11 /drivers/md | |
parent | 530f683ddcd211a4dc5d60a13e6f4918a541bb8d (diff) | |
download | linux-f5f93541202f2e619c1395f5d98868b70cf60f50.tar.xz |
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-bufio.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index e5459741335d..cca43ed13fd1 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) |