Skip to content

inetpeer: reduce false sharing and atomic operations

Eric Dumazet netdev 2 versions – 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 · linked by author and title

  1. v2 Latest4 patches 0 repliesApplied 4/4
  2. v14 patches 5 repliesSuperseded

Patches in v2 All 4 applied

#Subject and filesSizeRepliesApplied
1/4inetpeer: remove create argument of inet_getpeer_v[46]()include/net/inetpeer.h net/ipv4/icmp.c net/ipv4/ip_fragment.c +4 more+11 -120 repliesApplied
2/4inetpeer: remove create argument of inet_getpeer()include/net/inetpeer.h net/ipv4/inetpeer.c+5 -130 repliesApplied
3/4inetpeer: update inetpeer timestamp in inet_getpeer()net/ipv4/inetpeer.c+4 -80 repliesApplied
4/4inetpeer: do not get a refcount in inet_getpeer()net/ipv4/icmp.c net/ipv4/inetpeer.c net/ipv4/ip_fragment.c +4 more+32 -290 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 net-next 0/4] inetpeer: reduce false sharing and atomic operations

After commit 8c2bd38b95f7 ("icmp: change the order of rate limits"), there is a risk that a host receiving packets from an unique source targeting closed ports is using a common inet_peer structure from many cpus.

All these cpus have to acquire/release a refcount and update the inet_peer timestamp (p->dtime)

Switch to pure RCU to avoid changing the refcount, and update p->dtime only once per jiffy.

Tested:
DUT : 128 cores, 32 hw rx queues.
receiving 8,400,000 UDP packets per second, targeting closed ports.

Before the series:
- napi poll can not keep up, NIC drops 1,200,000 packets per second.
- We use 20 % of cpu cycles

After this series:
- All packets are received (no more hw drops)
- We use 12 % of cpu cycles.

v2: addded Simon and Ido feedback from v1
v1: https://lore.kernel.org/netdev/[email protected]/T/#mc6b32422714235f8608580a7dbf464c203300578

Eric Dumazet (4):
inetpeer: remove create argument of inet_getpeer_v[46]()
inetpeer: remove create argument of inet_getpeer()
inetpeer: update inetpeer timestamp in inet_getpeer()
inetpeer: do not get a refcount in inet_getpeer()

 include/net/inetpeer.h | 12 +++++-------
 net/ipv4/icmp.c        |  9 ++++-----
 net/ipv4/inetpeer.c    | 31 ++++++++-----------------------
 net/ipv4/ip_fragment.c | 15 ++++++++++-----
 net/ipv4/route.c       | 17 +++++++++--------
 net/ipv6/icmp.c        |  6 +++---
 net/ipv6/ip6_output.c  |  6 +++---
 net/ipv6/ndisc.c       |  8 +++++---
 8 files changed, 47 insertions(+), 57 deletions(-)
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog