From: Simon Horman <horms@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Neal Cardwell <ncardwell@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next] tcp: make smp_rmb() conditional in tcp_poll()
Date: Tue, 15 Sep 2026 08:07:42 +0100 [thread overview]
Message-ID: <20260915070742.GA314999@horms.kernel.org> (raw)
In-Reply-To: <20260913123224.762935-1-edumazet@google.com>
On Sun, Sep 13, 2026 at 12:32:24PM +0000, Eric Dumazet wrote:
> Commit a4d258036ed9 ("tcp: Fix race in tcp_poll") added smp_rmb() in
> tcp_poll() and smp_wmb() in tcp_reset() (now tcp_done_with_error())
> to ensure that if tcp_poll() observed socket closure, it would also
> observe sk->sk_err.
>
> Currently, tcp_poll() unconditionally executes smp_rmb() at the end
> of every invocation, which on weakly-ordered architectures such as ARM64
> emits a memory barrier instruction (dmb ishld) on the poll fast path,
> even for healthy, active sockets.
>
> However, tcp_poll() only needs this barrier if socket closure has been
> observed, to ensure that the error code set by tcp_done_with_error()
> before socket closure is visible before returning EPOLLERR.
>
> Move smp_rmb() inside the conditional block handling socket closure
> (shutdown == SHUTDOWN_MASK || state == TCP_CLOSE). For healthy
> connected sockets in epoll, tcp_poll() avoids the barrier entirely.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-09-15 7:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 12:32 [PATCH net-next] tcp: make smp_rmb() conditional in tcp_poll() Eric Dumazet
2026-09-15 7:07 ` Simon Horman [this message]
2026-09-15 13:00 ` patchwork-bot+netdevbpf
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=20260915070742.GA314999@horms.kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.