Netdev List
 help / color / mirror / Atom feed
* [PATCH v1 net-next 0/2] tcp/mptcp: Don't call tcp_update_recv_tstamps() if not needed.
@ 2026-11-04 16:49 Kuniyuki Iwashima
  2026-11-04 16:49 ` [PATCH v1 net-next 1/2] tcp: " Kuniyuki Iwashima
  2026-11-04 16:49 ` [PATCH v1 net-next 2/2] mptcp: " Kuniyuki Iwashima
  0 siblings, 2 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2026-11-04 16:49 UTC (permalink / raw)
  To: Eric Dumazet, Neal Cardwell, Matthieu Baerts, Mat Martineau,
	David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Geliang Tang, Simon Horman, Kuniyuki Iwashima, Kuniyuki Iwashima,
	netdev

When RX HWtstamp is enabled on NIC, skb_hwtstamps(skb)->hwtstamp
is set.

Then, recvmsg() always calls tcp_recv_timestamp() even when the
socket does not need timestamp.

Since it is called after release_sock() and touches sk->sk_tsflags,
which shares the same cacheline with sk->sk_forward_alloc, it stalls:

   0.31 │ 403:   test   %al,%al
   0.02 │      ↓ je     4a0
  12.40 │        test   $0x2,%bpl        ; if (cmsg_flags & TCP_CMSG_TS)
        │      ↓ je     48f
  11.59 │        mov    0x60(%r14),%r15  ; sock_flag(sk, SOCK_TSTAMP_NEW)
  12.25 │        mov    0x170(%r14),%ebx ; READ_ONCE(sk->sk_tsflags)
  20.70 │        mov    0xd0(%rsp),%rdi  ; if (tss->ts[0]) {
   0.39 │        test   %rdi,%rdi
        │      ↓ je     44c

Commit f0e70409b7eb ("net: avoid unconditionally touching
sk_tsflags on RX") introduced SOCK_TIMESTAMPING_ANY to avoid the
issue for UDP.

This series checks it to avoid touching sk->sk_tsflags unnecessarily.

With the change, tcp_rr -T 128 -F 10000 gains ~3% more throughput
on AMD EPYC 7B12 Zen 2 Rome (2 sockets, 256 vCPUs).

Kuniyuki Iwashima (2):
  tcp: Don't call tcp_update_recv_tstamps() if not needed.
  mptcp: Don't call tcp_update_recv_tstamps() if not needed.

 include/net/sock.h   |  7 +++++++
 net/ipv4/tcp.c       | 12 +++++++++---
 net/mptcp/protocol.c |  3 ++-
 3 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.56.0.385.gac671c819a-goog


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-11-04 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 16:49 [PATCH v1 net-next 0/2] tcp/mptcp: Don't call tcp_update_recv_tstamps() if not needed Kuniyuki Iwashima
2026-11-04 16:49 ` [PATCH v1 net-next 1/2] tcp: " Kuniyuki Iwashima
2026-11-04 18:25   ` Naman Gulati
2026-11-04 18:41   ` Eric Dumazet
2026-11-04 19:02     ` Kuniyuki Iwashima
2026-11-04 16:49 ` [PATCH v1 net-next 2/2] mptcp: " Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox