1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 23 Mar 2019 18:26:10 +0100
3 Subject: [PATCH] net: use bulk free in kfree_skb_list
5 Since we're freeing multiple skbs, we might as well use bulk free to save a
6 few cycles. Use the same conditions for bulk free as in napi_consume_skb.
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 --- a/net/core/skbuff.c
12 +++ b/net/core/skbuff.c
13 @@ -666,12 +666,44 @@ EXPORT_SYMBOL(kfree_skb);
15 void kfree_skb_list(struct sk_buff *segs)
18 - struct sk_buff *next = segs->next;
19 + struct sk_buff *next = segs;
25 + while ((segs = next) != NULL) {
28 + if (segs->fclone != SKB_FCLONE_UNAVAILABLE) {
33 + if (!skb_unref(segs))
36 + trace_kfree_skb(segs, __builtin_return_address(0));
38 + /* drop skb->head and call any destructors for packet */
39 + skb_release_all(segs);
42 + /* SLUB writes into objects when freeing */
46 + skbs[n_skbs++] = segs;
48 + if (n_skbs < ARRAY_SIZE(skbs))
51 + kmem_cache_free_bulk(skbuff_head_cache, n_skbs, skbs);
58 + kmem_cache_free_bulk(skbuff_head_cache, n_skbs, skbs);
60 EXPORT_SYMBOL(kfree_skb_list);