io_uring: be smarter about waking multiple CQ ring waiters
authorJens Axboe <axboe@kernel.dk>
Fri, 6 Aug 2021 20:04:31 +0000 (14:04 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 10 Aug 2021 23:51:02 +0000 (17:51 -0600)
commit36ac281018ff2c88e288b69bfb73e2a23efd9737
treef34701cdd6b011ddf974319f26a7a21ebddbf248
parenteb2c122a8835fc2216dbeb094c3b1341557deb23
io_uring: be smarter about waking multiple CQ ring waiters

Currently we only wake the first waiter, even if we have enough entries
posted to satisfy multiple waiters. Improve that situation so that
every waiter knows how much the CQ tail has to advance before they can
be safely woken up.

With this change, if we have N waiters each asking for 1 event and we get
4 completions, then we wake up 4 waiters. If we have N waiters asking
for 2 completions and we get 4 completions, then we wake up the first
two. Previously, only the first waiter would've been woken up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c