Subject: net: Remove preemption disabling in netif_rx()
From: Priyanka Jain <>
Date: Thu May 17 09:35:11 2012 +0530

From: Priyanka Jain <>

1)enqueue_to_backlog() (called from netif_rx) should be
  bind to a particluar CPU. This can be achieved by
  disabling migration. No need to disable preemption

2)Fixes crash "BUG: scheduling while atomic: ksoftirqd"
  in case of RT.
  If preemption is disabled, enqueue_to_backog() is called
  in atomic context. And if backlog exceeds its count,
  kfree_skb() is called. But in RT, kfree_skb() might
  gets scheduled out, so it expects non atomic context.

-Replace preempt_enable(), preempt_disable() with
 migrate_enable(), migrate_disable() respectively
-Replace get_cpu(), put_cpu() with get_cpu_light(),
 put_cpu_light() respectively

Signed-off-by: Priyanka Jain <>
Signed-off-by: Thomas Gleixner <>
Acked-by: Rajan Srivastava <>
Cc: <rostedt@goodmis.orgn>

Signed-off-by: Thomas Gleixner <>
[bigeasy: Remove assumption about migrate_disable() from the description.]
Signed-off-by: Sebastian Andrzej Siewior <>
Signed-off-by: Thomas Gleixner <>

 net/core/dev.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
@ net/core/dev.c:4887 @ static int netif_rx_internal(struct sk_b
 		struct rps_dev_flow voidflow, *rflow = &voidflow;
 		int cpu;
-		preempt_disable();
+		migrate_disable();
 		cpu = get_rps_cpu(skb->dev, skb, &rflow);
@ net/core/dev.c:4897 @ static int netif_rx_internal(struct sk_b
 		ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
-		preempt_enable();
+		migrate_enable();
 	} else
 		unsigned int qtail;
-		ret = enqueue_to_backlog(skb, get_cpu(), &qtail);
-		put_cpu();
+		ret = enqueue_to_backlog(skb, get_cpu_light(), &qtail);
+		put_cpu_light();
 	return ret;