public inbox for [email protected]
 help / color / mirror / Atom feed
From: Oleg Nesterov <[email protected]>
To: Christian Brauner <[email protected]>,
	Linus Torvalds <[email protected]>,
	Manfred Spraul <[email protected]>
Cc: "David S. Miller" <[email protected]>,
	Eric Dumazet <[email protected]>, Jens Axboe <[email protected]>,
	Pavel Begunkov <[email protected]>,
	WangYuli <[email protected]>,
	[email protected], [email protected],
	[email protected]
Subject: [PATCH 3/5] io_uring_poll: kill the no longer necessary barrier after poll_wait()
Date: Tue, 7 Jan 2025 17:27:30 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Now that poll_wait() provides a full barrier we can remove smp_rmb() from
io_uring_poll().

In fact I don't think smp_rmb() was correct, it can't serialize LOADs and
STOREs.

Signed-off-by: Oleg Nesterov <[email protected]>
---
 io_uring/io_uring.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 06ff41484e29..a64a82b93b86 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2809,13 +2809,12 @@ static __poll_t io_uring_poll(struct file *file, poll_table *wait)
 
 	if (unlikely(!ctx->poll_activated))
 		io_activate_pollwq(ctx);
-
-	poll_wait(file, &ctx->poll_wq, wait);
 	/*
-	 * synchronizes with barrier from wq_has_sleeper call in
-	 * io_commit_cqring
+	 * provides mb() which pairs with barrier from wq_has_sleeper
+	 * call in io_commit_cqring
 	 */
-	smp_rmb();
+	poll_wait(file, &ctx->poll_wq, wait);
+
 	if (!io_sqring_full(ctx))
 		mask |= EPOLLOUT | EPOLLWRNORM;
 
-- 
2.25.1.362.g51ebf55


  parent reply	other threads:[~2025-01-07 16:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-07 16:26 [PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll() Oleg Nesterov
2025-01-07 16:27 ` [PATCH 1/5] " Oleg Nesterov
2025-01-07 16:27 ` [PATCH 2/5] poll_wait: kill the obsolete wait_address check Oleg Nesterov
2025-01-07 16:27 ` Oleg Nesterov [this message]
2025-01-07 16:27 ` [PATCH 4/5] sock_poll_wait: kill the no longer necessary barrier after poll_wait() Oleg Nesterov
2025-01-07 16:27 ` [PATCH 5/5] poll: kill poll_does_not_wait() Oleg Nesterov
2025-01-07 17:38 ` [PATCH 0/5] poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll() Linus Torvalds
2025-01-07 22:55   ` Jens Axboe
2025-01-10 10:56   ` Christian Brauner
2025-01-10 11:00 ` Christian Brauner

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [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