All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/5] net: better drop accounting
@ 2025-08-26 12:50 Eric Dumazet
  2025-08-26 12:50 ` [PATCH v2 net-next 1/5] net: add sk_drops_read(), sk_drops_inc() and sk_drops_reset() helpers Eric Dumazet
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Eric Dumazet @ 2025-08-26 12:50 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 under DOS.

Add optional sk->sk_drop_counters pointer so that
protocols can opt-in to use two dedicated cache lines
to hold drop counters.

Convert UDP and RAW to use this infrastructure.

Tested on UDP (see patch 4/5 for details)

Before:

nstat -n ; sleep 1 ; nstat | grep Udp
Udp6InDatagrams                 615091             0.0
Udp6InErrors                    3904277            0.0
Udp6RcvbufErrors                3904277            0.0

After:

nstat -n ; sleep 1 ; nstat | grep Udp
Udp6InDatagrams                 816281             0.0
Udp6InErrors                    7497093            0.0
Udp6RcvbufErrors                7497093            0.0

Eric Dumazet (5):
  net: add sk_drops_read(), sk_drops_inc() and sk_drops_reset() helpers
  net: add sk_drops_skbadd() helper
  net: add sk->sk_drop_counters
  udp: add drop_counters to udp socket
  inet: raw: add drop_counters to raw sockets

 include/linux/ipv6.h                          |  2 +-
 include/linux/skmsg.h                         |  2 +-
 include/linux/udp.h                           |  1 +
 include/net/raw.h                             |  1 +
 include/net/sock.h                            | 56 ++++++++++++++++++-
 include/net/tcp.h                             |  2 +-
 include/net/udp.h                             |  3 +-
 net/core/datagram.c                           |  2 +-
 net/core/sock.c                               | 16 +++---
 net/ipv4/ping.c                               |  2 +-
 net/ipv4/raw.c                                |  7 ++-
 net/ipv4/tcp_input.c                          |  2 +-
 net/ipv4/tcp_ipv4.c                           |  4 +-
 net/ipv4/udp.c                                | 14 ++---
 net/ipv6/datagram.c                           |  2 +-
 net/ipv6/raw.c                                |  9 +--
 net/ipv6/tcp_ipv6.c                           |  4 +-
 net/ipv6/udp.c                                |  6 +-
 net/iucv/af_iucv.c                            |  4 +-
 net/mptcp/protocol.c                          |  2 +-
 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_udp4.c       |  3 +-
 .../selftests/bpf/progs/bpf_iter_udp6.c       |  4 +-
 28 files changed, 114 insertions(+), 56 deletions(-)

-- 
2.51.0.261.g7ce5a0a67e-goog


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

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

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 12:50 [PATCH v2 net-next 0/5] net: better drop accounting Eric Dumazet
2025-08-26 12:50 ` [PATCH v2 net-next 1/5] net: add sk_drops_read(), sk_drops_inc() and sk_drops_reset() helpers Eric Dumazet
2025-08-26 12:50 ` [PATCH v2 net-next 2/5] net: add sk_drops_skbadd() helper Eric Dumazet
2025-08-27  5:28   ` Kuniyuki Iwashima
2025-08-26 12:50 ` [PATCH v2 net-next 3/5] net: add sk->sk_drop_counters Eric Dumazet
2025-08-27  5:30   ` Kuniyuki Iwashima
2025-08-26 12:50 ` [PATCH v2 net-next 4/5] udp: add drop_counters to udp socket Eric Dumazet
2025-08-27  5:32   ` Kuniyuki Iwashima
2025-08-26 12:50 ` [PATCH v2 net-next 5/5] inet: raw: add drop_counters to raw sockets Eric Dumazet
2025-08-27  5:34   ` Kuniyuki Iwashima
2025-08-28 12:50 ` [PATCH v2 net-next 0/5] net: better drop accounting patchwork-bot+netdevbpf

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.