Skip to content

net: use skb_attempt_defer_free() in napi_consume_skb()

Eric Dumazet linux-tegra 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 Latest3 patches 32 repliesApplied 3/3

Patches in v1 All 3 applied

#Subject and filesSizeRepliesApplied
1/3net: allow skb_release_head_state() to be called multiple timesnet/core/skbuff.c+3 -42 repliesApplied
2/3net: fix napi_consume_skb() with alien skbsnet/core/skbuff.c+5 -019 repliesApplied
3/3net: increase skb_defer_max default to 128Documentation/admin-guide/sysctl/net.rst net/core/hotdata.c+3 -311 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchKuniyuki IwashimaToke Høiland-JørgensenJason XingJon HunterAditya GargWillem de Bruijn
1/3R-b R-b
2/3R-b R-b R-b R-b R-b T-b T-b R-b
3/3R-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 6 reviewers.

Read the v1 thread

Cover letter [PATCH net-next 0/3] net: use skb_attempt_defer_free() in napi_consume_skb()

There is a lack of NUMA awareness and more generally lack of slab caches affinity on TX completion path.

Modern drivers are using napi_consume_skb(), hoping to cache sk_buff in per-cpu caches so that they can be recycled in RX path.

Only use this if the skb was allocated on the same cpu, otherwise use skb_attempt_defer_free() so that the skb is freed on the original cpu.

This removes contention on SLUB spinlocks and data structures, and this makes sure that recycled sk_buff have correct NUMA locality.

After this series, I get ~50% improvement for an UDP tx workload on an AMD EPYC 9B45 (IDPF 200Gbit NIC with 32 TX queues).

I will later refactor skb_attempt_defer_free()
to no longer have to care of skb_shared() and skb_release_head_state().

Eric Dumazet (3):
net: allow skb_release_head_state() to be called multiple times
net: fix napi_consume_skb() with alien skbs
net: increase skb_defer_max default to 128

 Documentation/admin-guide/sysctl/net.rst |  4 ++--
 net/core/hotdata.c                       |  2 +-
 net/core/skbuff.c                        | 12 ++++++++----
 3 files changed, 11 insertions(+), 7 deletions(-)
Signature · 1 line
2.51.2.1041.gc1ab5b90ca-goog