Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53f89b88 authored by Liam Mark's avatar Liam Mark Committed by Gerrit - the friendly Code Review server
Browse files

skbuff: support disabling of skb fragment cache



Add config support to disable the network skb fragment cache.
Enabling this option ensures that when allocating skbs the network
skb fragment cache will not be used.

Disabling use of the fragment cache can be useful on some low end
targets because it reduces memory pressure.

Change-Id: If3be82741a51d9275e41ca2eca99db3d1a4b2fcb
Signed-off-by: default avatarLiam Mark <lmark@codeaurora.org>
parent 6f19e644
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -45,6 +45,16 @@ config COMPAT_NETLINK_MESSAGES
	  Newly written code should NEVER need this option but do
	  compat-independent messages instead!

config DISABLE_NET_SKB_FRAG_CACHE
	bool "Disable skb fragment cache"
	help
	  Enabling this option ensures that when allocating skbs the network
	  skb fragment cache is not used.
	  Disabling use of the fragment cache can be useful on some low end
	  targets because it reduces memory pressure.

	  If you are unsure how to answer this question, answer N.

menu "Networking options"

source "net/packet/Kconfig"
+17 −0
Original line number Diff line number Diff line
@@ -443,6 +443,7 @@ EXPORT_SYMBOL(netdev_alloc_frag);
 *
 *	%NULL is returned if there is no free memory.
 */
#ifndef CONFIG_DISABLE_NET_SKB_FRAG_CACHE
struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
				   unsigned int length, gfp_t gfp_mask)
{
@@ -473,6 +474,22 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
	}
	return skb;
}
#else
struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
				   unsigned int length, gfp_t gfp_mask)
{
	struct sk_buff *skb = NULL;

	skb = __alloc_skb(length + NET_SKB_PAD, gfp_mask,
			  SKB_ALLOC_RX, NUMA_NO_NODE);
	if (likely(skb)) {
		skb_reserve(skb, NET_SKB_PAD);
		skb->dev = dev;
	}
	return skb;
}
#endif

EXPORT_SYMBOL(__netdev_alloc_skb);

void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off,