diff options
author | Olivier Langlois <olivier@trillion01.com> | 2024-07-30 16:56:06 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-08-25 08:27:01 -0600 |
commit | 7255cd894539a96fefab9180185d268647c7341b (patch) | |
tree | b0d92214a8a9e1762dcafaf17a11ad54be44cc4c /io_uring/sqpoll.c | |
parent | a8edbb424b1391b077407c75d8f5d2ede77aa70d (diff) |
io_uring: micro optimization of __io_sq_thread() condition
reverse the order of the element evaluation in an if statement.
for many users that are not using iopoll, the iopoll_list will always
evaluate to false after having made a memory access whereas to_submit is
very likely already loaded in a register.
Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Reviewed-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/052ca60b5c49e7439e4b8bd33bfab4a09d36d3d6.1722374371.git.olivier@trillion01.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/sqpoll.c')
-rw-r--r-- | io_uring/sqpoll.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c index 3b50dc9586d1..e545bf240d35 100644 --- a/io_uring/sqpoll.c +++ b/io_uring/sqpoll.c @@ -176,7 +176,7 @@ static int __io_sq_thread(struct io_ring_ctx *ctx, bool cap_entries) if (cap_entries && to_submit > IORING_SQPOLL_CAP_ENTRIES_VALUE) to_submit = IORING_SQPOLL_CAP_ENTRIES_VALUE; - if (!wq_list_empty(&ctx->iopoll_list) || to_submit) { + if (to_submit || !wq_list_empty(&ctx->iopoll_list)) { const struct cred *creds = NULL; if (ctx->sq_creds != current_cred()) |