]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring: count CQEs in io_iopoll_check()
authorCaleb Sander Mateos <csander@purestorage.com>
Mon, 2 Mar 2026 17:29:12 +0000 (10:29 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Mar 2026 22:14:14 +0000 (16:14 -0600)
commit3a5e96d47f7ea37fb6adf37882eec1521f8ca75e
tree2873fe6f7f67dda3c9b04a0d40fc587a9a1a145b
parent7995be40deb3ab8b5df7bdf0621f33aa546aefa7
io_uring: count CQEs in io_iopoll_check()

A subsequent commit will allow uring_cmds that don't use iopoll on
IORING_SETUP_IOPOLL io_urings. As a result, CQEs can be posted without
setting the iopoll_completed flag for a request in iopoll_list or going
through task work. For example, a UBLK_U_IO_FETCH_IO_CMDS command could
call io_uring_mshot_cmd_post_cqe() to directly post a CQE. The
io_iopoll_check() loop currently only counts completions posted in
io_do_iopoll() when determining whether the min_events threshold has
been met. It also exits early if there are any existing CQEs before
polling, or if any CQEs are posted while running task work. CQEs posted
via io_uring_mshot_cmd_post_cqe() or other mechanisms won't be counted
against min_events.

Explicitly check the available CQEs in each io_iopoll_check() loop
iteration to account for CQEs posted in any fashion.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Link: https://patch.msgid.link/20260302172914.2488599-4-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c