io_uring: optimise head checks in io_get_sqring()
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 30 Dec 2019 18:24:45 +0000 (21:24 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 30 Dec 2019 22:26:01 +0000 (15:26 -0700)
commitb89bbff7e2f00ee9435a2b87fa5dbb0d0d73c870
tree73f8b732631ee42928b4bfd29d1ba674252197cd
parent19d32a70b14469f4f05203c6298f69b40edf1dec
io_uring: optimise head checks in io_get_sqring()

A user may ask to submit more than there is in the ring, and then
io_uring will submit as much as it can. However, in the last iteration
it will allocate an io_kiocb and immediately free it. It could do
better and adjust @to_submit to what is in the ring.

And since the ring's head is already checked here, there is no need to
do it in the loop, spamming with smp_load_acquire()'s barriers

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c