io_uring: optimise submission left counting
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 12 Apr 2022 14:09:50 +0000 (15:09 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 17 Apr 2022 22:55:33 +0000 (16:55 -0600)
commit9a5303f1354ed77d29333581d0260f4fc3a784eb
tree8db2e84214babdb4b49da75ba5275f9352f5ce74
parent6cde82768f4af50441f8f88fd45f1a8dbc40e6a8
io_uring: optimise submission left counting

Considering all inlining io_submit_sqe() is huge and usually ends up
calling some other functions.

We decrement @left in io_submit_sqes() just before calling
io_submit_sqe() and use it later after the call. Considering how huge
io_submit_sqe() is, there is not much hope @left will be treated
gracefully by compilers.

Decrement it after the call, not only it's easier on register spilling
and probably saves stack write/read, but also at least for x64 uses
CPU flags set by the dec instead of doing (read/write and tests).

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