From: Jesper Dangaard Brouer <brouer@redhat.com>
To: netdev@vger.kernel.org
Cc: Jesper Dangaard Brouer <brouer@redhat.com>,
Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
edumazet@google.com, pabeni@redhat.com
Subject: [PATCH net-next V2 0/2] net: use kmem_cache_free_bulk in kfree_skb_list
Date: Fri, 13 Jan 2023 14:51:54 +0100 [thread overview]
Message-ID: <167361788585.531803.686364041841425360.stgit@firesoul> (raw)
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(-)
--
next reply other threads:[~2023-01-13 13:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 13:51 Jesper Dangaard Brouer [this message]
2023-01-13 13:51 ` [PATCH net-next V2 1/2] net: fix call location in kfree_skb_list_reason Jesper Dangaard Brouer
2023-01-13 13:52 ` [PATCH net-next V2 2/2] net: kfree_skb_list use kmem_cache_free_bulk Jesper Dangaard Brouer
2023-01-18 16:05 ` Eric Dumazet
2023-01-18 16:42 ` Jesper Dangaard Brouer
2023-01-18 16:42 ` Eric Dumazet
2023-01-18 21:37 ` Jesper Dangaard Brouer
2023-01-19 2:26 ` Jakub Kicinski
2023-01-19 10:17 ` Jesper Dangaard Brouer
2023-01-19 10:28 ` Eric Dumazet
2023-01-19 11:22 ` Jesper Dangaard Brouer
2023-01-19 11:46 ` Eric Dumazet
2023-01-19 13:18 ` Jesper Dangaard Brouer
2023-01-19 2:39 ` Yunsheng Lin
2023-01-17 9:40 ` [PATCH net-next V2 0/2] net: use kmem_cache_free_bulk in kfree_skb_list patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=167361788585.531803.686364041841425360.stgit@firesoul \
--to=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox