* [PATCH v1] fs/io_uring: Prioritise checking faster conditions first in io_write
@ 2021-10-17 1:32 Noah Goldstein
2021-10-17 14:23 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Noah Goldstein @ 2021-10-17 1:32 UTC (permalink / raw)
Cc: goldstein.w.n, axboe, asml.silence, io-uring, linux-kernel
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: Noah Goldstein <[email protected]>
---
fs/io_uring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6b9e70208782..321de7ddf2cf 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3660,7 +3660,7 @@ static int io_write(struct io_kiocb *req, unsigned int issue_flags)
goto done;
if (!force_nonblock || ret2 != -EAGAIN) {
/* 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;
done:
kiocb_done(kiocb, ret2, issue_flags);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-17 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-17 1:32 [PATCH v1] fs/io_uring: Prioritise checking faster conditions first in io_write Noah Goldstein
2021-10-17 14:23 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox