tcp: adopt try_cmpxchg() in tcp_release_cb()
Subsystems (3)
PATCH 1/1 tcp: adopt try_cmpxchg() in tcp_release_cb()
try_cmpxchg() is slighly more efficient (at least on x86), and smp_load_acquire(&sk->sk_tsq_flags) could avoid a KCSAN report.
Signed-off-by Eric Dumazet <[email protected]>
--- net/ipv4/tcp_output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/tcp_output.c +3 -3
@@ -1077,15 +1077,15 @@ static void tcp_tasklet_func(struct tasklet_struct *t)*/ void tcp_release_cb (struct sock *sk) { -unsigned long flags, nflags; +unsigned long flags =smp_load_acquire (&sk->sk_tsq_flags); +unsigned long nflags;/* perform an atomic operation only if at least one flag is set */ do { - flags = sk->sk_tsq_flags;if (!(flags &TCP_DEFERRED_ALL ))return ; nflags = flags & ~TCP_DEFERRED_ALL ; - }while (cmpxchg (&sk->sk_tsq_flags, flags, nflags) != flags); + }while (!try_cmpxchg (&sk->sk_tsq_flags, &flags, nflags));if (flags &TCPF_TSQ_DEFERRED ) {tcp_tsq_write (sk);
Signature · 1 line
2.38.1.431.g37b22c650d-goog
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 7 lines · On Thu, 10 Nov 2022 17:48:29 +0000 you wrote:
try_cmpxchg()is slighly more efficient (at least on x86), andsmp_load_acquire(&sk->sk_tsq_flags)could avoid a KCSAN report.Signed-off-by Eric Dumazet <[email protected]>--- net/ipv4/tcp_output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Here is the summary with links:
- [net-next] tcp: adopt try_cmpxchg() in tcp_release_cb()
https://git.kernel.org/netdev/net-next/c/fac30731b9b8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html