Skip to content

udp: increase RX performance under stress

Eric Dumazet netdev 1 version Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 43 repliesApplied 10/10

Patches in v1 All 10 applied

#Subject and filesSizeRepliesApplied
1/10ipv6: make ipv6_pinfo.saddr_cache a booleaninclude/linux/ipv6.h include/net/ip6_route.h net/ipv6/af_inet6.c +4 more+12 -113 repliesApplied
2/10ipv6: make ipv6_pinfo.daddr_cache a booleaninclude/linux/ipv6.h include/net/ip6_route.h net/ipv6/af_inet6.c +4 more+10 -103 repliesApplied
3/10ipv6: np->rxpmtu race annotationnet/ipv6/raw.c net/ipv6/udp.c+2 -23 repliesApplied
4/10ipv6: reorganise struct ipv6_pinfoinclude/linux/ipv6.h+16 -173 repliesApplied
5/10udp: refine __udp_enqueue_schedule_skb() testnet/ipv4/udp.c+2 -25 repliesApplied
6/10udp: update sk_rmem_alloc before busylock acquisitionnet/ipv4/udp.c+5 -25 repliesApplied
7/10net: group sk_backlog and sk_receive_queueinclude/net/sock.h+1 -13 repliesApplied
8/10udp: add udp_drops_inc() helperinclude/net/sock.h include/net/udp.h net/core/sock.c +2 more+15 -113 repliesApplied
9/10udp: make busylock per socketinclude/linux/udp.h include/net/udp.h net/ipv4/udp.c+4 -186 repliesApplied
10/10udp: use skb_attempt_defer_free()net/ipv4/udp.c+7 -08 repliesApplied

Reviews trailers per patch

All 10 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchWillem de BruijnDavid AhernKuniyuki IwashimaJakub Kicinski
SeriesR-b
1/10R-b R-b R-b
2/10R-b R-b R-b
3/10R-b R-b R-b
4/10R-b R-b R-b
5/10R-b R-b R-b
6/10R-b R-b R-b
7/10R-b R-b R-b
8/10R-b R-b R-b
9/10R-b R-b R-b
10/10A-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH net-next 00/10] udp: increase RX performance under stress

This series is the result of careful analysis of UDP stack, to optimize the receive side, especially when under one or several UDP sockets are receiving a DDOS attack.

I have measured a 47 % increase of throughput when using IPv6 UDP packets with 120 bytes of payload, under DDOS.

16 cpus are receiving traffic targeting a single socket.

Even after adding NUMA aware drop counters, we were suffering from false sharing between packet producers and the consumer.

1) First four patches are shrinking struct ipv6_pinfo size and reorganize fields to get more efficient TX path. They should also benefit TCP, by removing one cache line miss.

2) patches 5 & 6 changes how sk->sk_rmem_alloc is read and updated. They reduce reduce spinlock contention on the busylock.

3) Patches 7 & 8 change the ordering of sk_backlog (including sk_rmem_alloc) sk_receive_queue and sk_drop_counters for better data locality.

4) Patch 9 removes the hashed array of spinlocks in favor of a per-udp-socket one.

5) Final patch adopts skb_attempt_defer_free(), after TCP got good results with it.

Eric Dumazet (10):
ipv6: make ipv6_pinfo.saddr_cache a boolean
ipv6: make ipv6_pinfo.daddr_cache a boolean
ipv6: np->rxpmtu race annotation
ipv6: reorganise struct ipv6_pinfo
udp: refine __udp_enqueue_schedule_skb() test
udp: update sk_rmem_alloc before busylock acquisition
net: group sk_backlog and sk_receive_queue
udp: add udp_drops_inc() helper
udp: make busylock per socket
udp: use skb_attempt_defer_free()

 include/linux/ipv6.h             | 37 ++++++++++++-----------
 include/linux/udp.h              |  1 +
 include/net/ip6_route.h          |  8 ++---
 include/net/sock.h               |  4 +--
 include/net/udp.h                |  6 ++++
 net/core/sock.c                  |  1 -
 net/ipv4/udp.c                   | 50 ++++++++++++++------------------
 net/ipv6/af_inet6.c              |  2 +-
 net/ipv6/inet6_connection_sock.c |  2 +-
 net/ipv6/ip6_output.c            |  6 ++--
 net/ipv6/raw.c                   |  2 +-
 net/ipv6/route.c                 |  7 ++---
 net/ipv6/tcp_ipv6.c              |  4 +--
 net/ipv6/udp.c                   |  8 ++---
 14 files changed, 69 insertions(+), 69 deletions(-)
Signature · 1 line
2.51.0.384.g4c02a37b29-goog