]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - net/core/skbuff.c
skbuff: back tiny skbs with kmalloc() in __netdev_alloc_skb() too
[mirror_ubuntu-hirsute-kernel.git] / net / core / skbuff.c
index c1a6f262636a15c828100c8e80cd5021bebe89f7..785daff48030d328b879afe58db35c8d96a58ea7 100644 (file)
@@ -437,7 +437,11 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len,
 
        len += NET_SKB_PAD;
 
-       if ((len > SKB_WITH_OVERHEAD(PAGE_SIZE)) ||
+       /* If requested length is either too small or too big,
+        * we use kmalloc() for skb->head allocation.
+        */
+       if (len <= SKB_WITH_OVERHEAD(1024) ||
+           len > SKB_WITH_OVERHEAD(PAGE_SIZE) ||
            (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) {
                skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE);
                if (!skb)