diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2021-04-11 01:46:31 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-04-11 19:30:41 -0600 |
commit | 44c769de6ffc3f1ea524fc9b7517c97078796e29 (patch) | |
tree | 107fd62beb80bb2f35fed3b000b3dc8511ffb67f /fs/io_uring.c | |
parent | 4af3417a347d06c8632346a6a9035c28b1dd94b4 (diff) | |
download | linux-44c769de6ffc3f1ea524fc9b7517c97078796e29.tar.bz2 |
io_uring: optimise non-eventfd post-event
Eventfd is not the canonical way of using io_uring, annotate
io_should_trigger_evfd() with likely so it improves code generation for
non-eventfd branch.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/42fdaa51c68d39479f02cef4fe5bcb24624d60fa.1618101759.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index 1779306c50d2..108b0c49db64 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1355,13 +1355,11 @@ static struct io_uring_cqe *io_get_cqring(struct io_ring_ctx *ctx) static inline bool io_should_trigger_evfd(struct io_ring_ctx *ctx) { - if (!ctx->cq_ev_fd) + if (likely(!ctx->cq_ev_fd)) return false; if (READ_ONCE(ctx->rings->cq_flags) & IORING_CQ_EVENTFD_DISABLED) return false; - if (!ctx->eventfd_async) - return true; - return io_wq_current_is_worker(); + return !ctx->eventfd_async || io_wq_current_is_worker(); } static void io_cqring_ev_posted(struct io_ring_ctx *ctx) |