1 From f9ec2fd888d64cd7e5605a2f390c6c482b7d8e1e Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Wed, 26 Sep 2012 16:21:08 +0200
4 Subject: [PATCH 227/366] net: Another local_irq_disable/kmalloc headache
6 Replace it by a local lock. Though that's pretty inefficient :(
8 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
10 net/core/skbuff.c | 6 ++++--
11 1 file changed, 4 insertions(+), 2 deletions(-)
13 diff --git a/net/core/skbuff.c b/net/core/skbuff.c
14 index 4968b5d..9d20d9a5 100644
15 --- a/net/core/skbuff.c
16 +++ b/net/core/skbuff.c
18 #include <linux/errqueue.h>
19 #include <linux/prefetch.h>
20 #include <linux/if_vlan.h>
21 +#include <linux/locallock.h>
23 #include <net/protocol.h>
25 @@ -351,6 +352,7 @@ EXPORT_SYMBOL(build_skb);
27 static DEFINE_PER_CPU(struct page_frag_cache, netdev_alloc_cache);
28 static DEFINE_PER_CPU(struct page_frag_cache, napi_alloc_cache);
29 +static DEFINE_LOCAL_IRQ_LOCK(netdev_alloc_lock);
31 static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
33 @@ -358,10 +360,10 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
37 - local_irq_save(flags);
38 + local_lock_irqsave(netdev_alloc_lock, flags);
39 nc = this_cpu_ptr(&netdev_alloc_cache);
40 data = __alloc_page_frag(nc, fragsz, gfp_mask);
41 - local_irq_restore(flags);
42 + local_unlock_irqrestore(netdev_alloc_lock, flags);