Commit 258f3a7f authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: optimise rw comletion handlers

Don't override req->result in io_complete_rw_iopoll() when it's already
of the same value, we have an if just above it, so move the assignment
there. Also, add one simle unlikely() in __io_complete_rw_common().
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/8dfeb4f84026a20172bcf82c05010abe955874ae.1634144845.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f80a50a6
...@@ -2640,7 +2640,7 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res) ...@@ -2640,7 +2640,7 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res)
{ {
if (req->rw.kiocb.ki_flags & IOCB_WRITE) if (req->rw.kiocb.ki_flags & IOCB_WRITE)
kiocb_end_write(req); kiocb_end_write(req);
if (res != req->result) { if (unlikely(res != req->result)) {
if ((res == -EAGAIN || res == -EOPNOTSUPP) && if ((res == -EAGAIN || res == -EOPNOTSUPP) &&
io_rw_should_reissue(req)) { io_rw_should_reissue(req)) {
req->flags |= REQ_F_REISSUE; req->flags |= REQ_F_REISSUE;
...@@ -2695,9 +2695,9 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) ...@@ -2695,9 +2695,9 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2)
req->flags |= REQ_F_REISSUE; req->flags |= REQ_F_REISSUE;
return; return;
} }
req->result = res;
} }
req->result = res;
/* order with io_iopoll_complete() checking ->iopoll_completed */ /* order with io_iopoll_complete() checking ->iopoll_completed */
smp_store_release(&req->iopoll_completed, 1); smp_store_release(&req->iopoll_completed, 1);
} }
......
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