io_uring: optimise submission loop invariant
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 12 Apr 2022 14:09:49 +0000 (15:09 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 17 Apr 2022 22:55:33 +0000 (16:55 -0600)
commit6cde82768f4af50441f8f88fd45f1a8dbc40e6a8
tree0b4b9377d66dc71abab55e4ecb3f624a33a2ce25
parenta463053e51c642040d85c465dec1b94951cff037
io_uring: optimise submission loop invariant

Instead of keeping @submitted in io_submit_sqes(), which for each
iteration requires comparison with the initial number of SQEs, store the
number of SQEs left to submit. We'll need nr only for when we're done
with SQE handling.

note: if we can't allocate a req for the first SQE we always has been
returning -EAGAIN to the userspace, save this behaviour by looking into
the cache in a slow path.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c3b3df9aeae4c2f7a53fd8386385742e4e261e77.1649771823.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c