netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net: use kmem_cache_free_bulk in kfree_skb_list
@ 2023-01-05 15:42 Jesper Dangaard Brouer
  2023-01-05 15:42 ` [PATCH net-next 1/2] net: fix call location in kfree_skb_list_reason Jesper Dangaard Brouer
  2023-01-05 15:42 ` [PATCH net-next 2/2] net: kfree_skb_list use kmem_cache_free_bulk Jesper Dangaard Brouer
  0 siblings, 2 replies; 13+ messages in thread
From: Jesper Dangaard Brouer @ 2023-01-05 15:42 UTC (permalink / raw)
  To: netdev
  Cc: Jesper Dangaard Brouer, Jakub Kicinski, David S. Miller, edumazet,
	pabeni

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).

---

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 | 67 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 56 insertions(+), 11 deletions(-)

--


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

end of thread, other threads:[~2023-01-13 13:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-05 15:42 [PATCH net-next 0/2] net: use kmem_cache_free_bulk in kfree_skb_list Jesper Dangaard Brouer
2023-01-05 15:42 ` [PATCH net-next 1/2] net: fix call location in kfree_skb_list_reason Jesper Dangaard Brouer
2023-01-06 19:54   ` Saeed Mahameed
2023-01-06 19:57     ` Saeed Mahameed
2023-01-05 15:42 ` [PATCH net-next 2/2] net: kfree_skb_list use kmem_cache_free_bulk Jesper Dangaard Brouer
2023-01-06 20:09   ` Saeed Mahameed
2023-01-06 22:33   ` Jakub Kicinski
2023-01-09 12:24     ` Jesper Dangaard Brouer
2023-01-09 19:34       ` Jakub Kicinski
2023-01-09 22:10         ` Alexander H Duyck
2023-01-10 14:52           ` Jesper Dangaard Brouer
2023-01-10 20:20             ` Jakub Kicinski
2023-01-13 13:42               ` Jesper Dangaard Brouer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).