]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - rt-patches/0226-net-Remove-preemption-disabling-in-netif_rx.patch
Fix memguard and related syscalls
[hercules2020/nv-tegra/linux-4.4.git] / rt-patches / 0226-net-Remove-preemption-disabling-in-netif_rx.patch
1 From 03adb68ec774b87afff9f7f37289872ee5ddd9d7 Mon Sep 17 00:00:00 2001
2 From: Priyanka Jain <Priyanka.Jain@freescale.com>
3 Date: Thu, 17 May 2012 09:35:11 +0530
4 Subject: [PATCH 226/366] net: Remove preemption disabling in netif_rx()
5
6 1)enqueue_to_backlog() (called from netif_rx) should be
7   bind to a particluar CPU. This can be achieved by
8   disabling migration. No need to disable preemption
9
10 2)Fixes crash "BUG: scheduling while atomic: ksoftirqd"
11   in case of RT.
12   If preemption is disabled, enqueue_to_backog() is called
13   in atomic context. And if backlog exceeds its count,
14   kfree_skb() is called. But in RT, kfree_skb() might
15   gets scheduled out, so it expects non atomic context.
16
17 3)When CONFIG_PREEMPT_RT_FULL is not defined,
18  migrate_enable(), migrate_disable() maps to
19  preempt_enable() and preempt_disable(), so no
20  change in functionality in case of non-RT.
21
22 -Replace preempt_enable(), preempt_disable() with
23  migrate_enable(), migrate_disable() respectively
24 -Replace get_cpu(), put_cpu() with get_cpu_light(),
25  put_cpu_light() respectively
26
27 Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
28 Acked-by: Rajan Srivastava <Rajan.Srivastava@freescale.com>
29 Cc: <rostedt@goodmis.orgn>
30 Link: http://lkml.kernel.org/r/1337227511-2271-1-git-send-email-Priyanka.Jain@freescale.com
31
32 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
33 ---
34  net/core/dev.c | 8 ++++----
35  1 file changed, 4 insertions(+), 4 deletions(-)
36
37 diff --git a/net/core/dev.c b/net/core/dev.c
38 index 12b76f9..437e5fe 100644
39 --- a/net/core/dev.c
40 +++ b/net/core/dev.c
41 @@ -3546,7 +3546,7 @@ static int netif_rx_internal(struct sk_buff *skb)
42                 struct rps_dev_flow voidflow, *rflow = &voidflow;
43                 int cpu;
44  
45 -               preempt_disable();
46 +               migrate_disable();
47                 rcu_read_lock();
48  
49                 cpu = get_rps_cpu(skb->dev, skb, &rflow);
50 @@ -3556,13 +3556,13 @@ static int netif_rx_internal(struct sk_buff *skb)
51                 ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
52  
53                 rcu_read_unlock();
54 -               preempt_enable();
55 +               migrate_enable();
56         } else
57  #endif
58         {
59                 unsigned int qtail;
60 -               ret = enqueue_to_backlog(skb, get_cpu(), &qtail);
61 -               put_cpu();
62 +               ret = enqueue_to_backlog(skb, get_cpu_light(), &qtail);
63 +               put_cpu_light();
64         }
65         return ret;
66  }
67 -- 
68 1.9.1
69