netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: better drop accounting
@ 2025-08-25 19:59 Eric Dumazet
  2025-08-25 19:59 ` [PATCH net-next 1/3] net: add sk_drops_read(), sk_drops_inc() and sk_drops_reset() helpers Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Eric Dumazet @ 2025-08-25 19:59 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, netdev, eric.dumazet, Willem de Bruijn,
	Kuniyuki Iwashima, Eric Dumazet

Incrementing sk->sk_drops for every dropped packet can
cause serious cache line contention.

Move sk_drops into a separate cache line so that
the consumer reads packets faster.

Add sk->sk_drops1 field for basic NUMA awareness
at low memory cost.

Tested:
see the 2nd patch changelog for test setup.
(One UDP receiving socket)

Before:

Udp6InDatagrams                 615091             0.0
Udp6InErrors                    3904277            0.0
Udp6RcvbufErrors                3904277            0.0

After:

Udp6InDatagrams                 914537             0.0
Udp6InErrors                    6888487            0.0
Udp6RcvbufErrors                6888487            0.0

Eric Dumazet (3):
  net: add sk_drops_read(), sk_drops_inc() and sk_drops_reset() helpers
  net: move sk_drops out of sock_write_rx group
  net: add new sk->sk_drops1 field

 include/net/sock.h                            | 43 +++++++++++++++++--
 include/net/tcp.h                             |  2 +-
 net/core/datagram.c                           |  2 +-
 net/core/sock.c                               | 15 +++----
 net/ipv4/ping.c                               |  2 +-
 net/ipv4/raw.c                                |  6 +--
 net/ipv4/udp.c                                | 14 +++---
 net/ipv6/datagram.c                           |  2 +-
 net/ipv6/raw.c                                |  8 ++--
 net/ipv6/udp.c                                |  6 +--
 net/iucv/af_iucv.c                            |  4 +-
 net/netlink/af_netlink.c                      |  4 +-
 net/packet/af_packet.c                        |  2 +-
 net/phonet/pep.c                              |  6 +--
 net/phonet/socket.c                           |  2 +-
 net/sctp/diag.c                               |  2 +-
 net/tipc/socket.c                             |  6 +--
 .../selftests/bpf/progs/bpf_iter_netlink.c    |  3 +-
 .../selftests/bpf/progs/bpf_iter_udp4.c       |  2 +-
 .../selftests/bpf/progs/bpf_iter_udp6.c       |  2 +-
 20 files changed, 84 insertions(+), 49 deletions(-)

-- 
2.51.0.261.g7ce5a0a67e-goog


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

end of thread, other threads:[~2025-08-26 12:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25 19:59 [PATCH net-next 0/3] net: better drop accounting Eric Dumazet
2025-08-25 19:59 ` [PATCH net-next 1/3] net: add sk_drops_read(), sk_drops_inc() and sk_drops_reset() helpers Eric Dumazet
2025-08-25 20:15   ` Kuniyuki Iwashima
2025-08-25 19:59 ` [PATCH net-next 2/3] net: move sk_drops out of sock_write_rx group Eric Dumazet
2025-08-25 20:17   ` Kuniyuki Iwashima
2025-08-25 19:59 ` [PATCH net-next 3/3] net: add new sk->sk_drops1 field Eric Dumazet
2025-08-25 20:19   ` Kuniyuki Iwashima
2025-08-26  5:46     ` Eric Dumazet
2025-08-26  5:56       ` Kuniyuki Iwashima
2025-08-26  6:33   ` Paolo Abeni
2025-08-26  6:46     ` Eric Dumazet
2025-08-26  7:16       ` Paolo Abeni
2025-08-26 12:11         ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).