Commit b10841c9 authored by Noah Goldstein's avatar Noah Goldstein Committed by Jens Axboe

fs/io_uring: Prioritise checking faster conditions first in io_write

This commit reorders the conditions in a branch in io_write. The
reorder to check 'ret2 == -EAGAIN' first as checking
'(req->ctx->flags & IORING_SETUP_IOPOLL)' will likely be more
expensive due to 2x memory derefences.
Signed-off-by: default avatarNoah Goldstein <goldstein.w.n@gmail.com>
Link: https://lore.kernel.org/r/20211017013229.4124279-1-goldstein.w.n@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5cb03d63
...@@ -3654,7 +3654,7 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags) ...@@ -3654,7 +3654,7 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
goto done; goto done;
if (!force_nonblock || ret2 != -EAGAIN) { if (!force_nonblock || ret2 != -EAGAIN) {
/* IOPOLL retry should happen for io-wq threads */ /* IOPOLL retry should happen for io-wq threads */
if ((req->ctx->flags & IORING_SETUP_IOPOLL) && ret2 == -EAGAIN) if (ret2 == -EAGAIN && (req->ctx->flags & IORING_SETUP_IOPOLL))
goto copy_iov; goto copy_iov;
done: done:
kiocb_done(kiocb, ret2, issue_flags); kiocb_done(kiocb, ret2, issue_flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment