From b6347d1d5712275438a861ba94a01a4816266363 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Thu, 27 Oct 2011 15:53:38 -0400 Subject: [PATCH] net: add FCLONE_SCRATCH use to ipv4 udp path UDP v4 multicast in a multiple group listener workload is a heavy user of skb_clone, which can lead to performance problems if memory is constrained and frame reception rates are high. Once in the udp path however, we can reserve the unused storage of the udp datagram and allocate skbs from it quickly. Modify the udp multicast receive path to reserve storage using the FCLONE_SCRATCH api to make opportunistic use of this space. Tested successfully by myself Signed-off-by: Neil Horman CC: "David S. Miller" --- net/ipv4/udp.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 659f3b2..4ad9325 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -1430,7 +1430,6 @@ drop: return -1; } - static void flush_stack(struct sock **stack, unsigned int count, struct sk_buff *skb, unsigned int final) { @@ -1473,6 +1472,8 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb, int dif; unsigned int i, count = 0; + skb_make_fclone_scratch(skb); + spin_lock(&hslot->lock); sk = sk_nulls_head(&hslot->head); dif = skb->dev->ifindex; -- 1.7.1