From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 5/7] io_uring: shuffle io_eventfd_signal() bits around
Date: Thu, 17 Mar 2022 02:03:40 +0000 [thread overview]
Message-ID: <ec4091ac76d43912b73917e8db651c2dac4b7b01.1647481208.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
A preparation patch, which moves a fast ->io_ev_fd check out of
io_eventfd_signal() into ev_posted*(). Compilers are smart enough for it
to not change anything, but will need it later.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 603cbe687dd2..5a87e0622ecb 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1820,10 +1820,6 @@ static void io_eventfd_signal(struct io_ring_ctx *ctx)
{
struct io_ev_fd *ev_fd;
- /* Return quickly if ctx->io_ev_fd doesn't exist */
- if (likely(!rcu_dereference_raw(ctx->io_ev_fd)))
- return;
-
rcu_read_lock();
/*
* rcu_dereference ctx->io_ev_fd once and use it for both for checking
@@ -1843,7 +1839,6 @@ static void io_eventfd_signal(struct io_ring_ctx *ctx)
if (!ev_fd->eventfd_async || io_wq_current_is_worker())
eventfd_signal(ev_fd->cq_ev_fd, 1);
-
out:
rcu_read_unlock();
}
@@ -1855,7 +1850,7 @@ static void io_eventfd_signal(struct io_ring_ctx *ctx)
* 1:1 relationship between how many times this function is called (and
* hence the eventfd count) and number of CQEs posted to the CQ ring.
*/
-static void io_cqring_ev_posted(struct io_ring_ctx *ctx)
+static inline void io_cqring_ev_posted(struct io_ring_ctx *ctx)
{
/*
* wake_up_all() may seem excessive, but io_wake_function() and
@@ -1864,7 +1859,8 @@ static void io_cqring_ev_posted(struct io_ring_ctx *ctx)
*/
if (wq_has_sleeper(&ctx->cq_wait))
wake_up_all(&ctx->cq_wait);
- io_eventfd_signal(ctx);
+ if (unlikely(rcu_dereference_raw(ctx->io_ev_fd)))
+ io_eventfd_signal(ctx);
}
static void io_cqring_ev_posted_iopoll(struct io_ring_ctx *ctx)
@@ -1873,7 +1869,8 @@ static void io_cqring_ev_posted_iopoll(struct io_ring_ctx *ctx)
if (wq_has_sleeper(&ctx->cq_wait))
wake_up_all(&ctx->cq_wait);
}
- io_eventfd_signal(ctx);
+ if (unlikely(rcu_dereference_raw(ctx->io_ev_fd)))
+ io_eventfd_signal(ctx);
}
/* Returns true if there are no backlogged entries after the flush */
--
2.35.1
next prev parent reply other threads:[~2022-03-17 2:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-17 2:03 [PATCH for-next 0/7] completion path optimisations Pavel Begunkov
2022-03-17 2:03 ` [PATCH 1/7] io_uring: normilise naming for fill_cqe* Pavel Begunkov
2022-03-17 2:03 ` [PATCH 2/7] io_uring: refactor timeout cancellation cqe posting Pavel Begunkov
2022-03-17 2:03 ` [PATCH 3/7] io_uring: extend provided buf return to fails Pavel Begunkov
2022-03-17 2:14 ` Jens Axboe
2022-03-17 2:03 ` [PATCH 4/7] io_uring: remove extra barrier for non-sqpoll iopoll Pavel Begunkov
2022-03-17 2:03 ` Pavel Begunkov [this message]
2022-03-17 2:03 ` [PATCH 6/7] io_uring: thin down io_commit_cqring() Pavel Begunkov
2022-03-17 2:03 ` [PATCH 7/7] io_uring: fold evfd signalling under a slower path Pavel Begunkov
2022-03-17 12:31 ` [PATCH for-next 0/7] completion path optimisations Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ec4091ac76d43912b73917e8db651c2dac4b7b01.1647481208.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox