Skip to content

net: use kmem_cache_free_bulk in kfree_skb_list

Jesper Dangaard Brouer netdev 2 versions – Applied

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

Get series with b4
b4 am 167361788585.531803.686364041841425360.stgit@firesoul

Versions newest first · linked by author and title

  1. v2 Latest2 patches 11 repliesApplied 2/2
  2. v12 patches 10 repliesSuperseded

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2net: fix call location in kfree_skb_list_reasonnet/core/skbuff.c+21 -130 repliesApplied
2/2net: kfree_skb_list use kmem_cache_free_bulknet/core/skbuff.c+39 -111 repliesApplied

Reviews trailers per patch

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

PatchSaeed Mahameed
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next V2 0/2] net: use kmem_cache_free_bulk in kfree_skb_list

The kfree_skb_list function walks SKB (via skb->next) and frees them individually to the SLUB/SLAB allocator (kmem_cache). It is more efficient to bulk free them via the kmem_cache_free_bulk API.

Netstack NAPI fastpath already uses kmem_cache bulk alloc and free APIs for SKBs.

The kfree_skb_list call got an interesting optimization in commit 520ac30f4551 ("net_sched: drop packets after root qdisc lock is released") that can create a list of SKBs "to_free" e.g. when qdisc enqueue fails or deliberately chooses to drop . It isn't a normal data fastpath, but the situation will likely occur when system/qdisc are under heavy workloads, thus it makes sense to use a faster API for freeing the SKBs.

E.g. the (often distro default) qdisc fq_codel will drop batches of packets from fattest elephant flow, default capped at 64 packets (but adjustable via tc argument drop_batch).

Performance measurements done in [1]:
[1] https://github.com/xdp-project/xdp-project/blob/master/areas/mem/kfree_skb_list01.org

---

Jesper Dangaard Brouer (2):
net: fix call location in kfree_skb_list_reason
net: kfree_skb_list use kmem_cache_free_bulk

 net/core/skbuff.c | 68 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 57 insertions(+), 11 deletions(-)

--