]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0227-net-Another-local_irq_disable-kmalloc-headache.patch
rt_patches: required rebase due to printk change
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0227-net-Another-local_irq_disable-kmalloc-headache.patch
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
5
6 Replace it by a local lock. Though that's pretty inefficient :(
7
8 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
9 ---
10  net/core/skbuff.c | 6 ++++--
11  1 file changed, 4 insertions(+), 2 deletions(-)
12
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
17 @@ -63,6 +63,7 @@
18  #include <linux/errqueue.h>
19  #include <linux/prefetch.h>
20  #include <linux/if_vlan.h>
21 +#include <linux/locallock.h>
22  
23  #include <net/protocol.h>
24  #include <net/dst.h>
25 @@ -351,6 +352,7 @@ EXPORT_SYMBOL(build_skb);
26  
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);
30  
31  static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
32  {
33 @@ -358,10 +360,10 @@ static void *__netdev_alloc_frag(unsigned int fragsz, gfp_t gfp_mask)
34         unsigned long flags;
35         void *data;
36  
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);
43         return data;
44  }
45  
46 -- 
47 1.9.1
48