Skip to content

Commit

Permalink
net: Remove preemption disabling in netif_rx()
Browse files Browse the repository at this point in the history
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 <Priyanka.Jain@freescale.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Rajan Srivastava <Rajan.Srivastava@freescale.com>
Cc: <rostedt@goodmis.orgn>
Link: http://lkml.kernel.org/r/1337227511-2271-1-git-send-email-Priyanka.Jain@freescale.com

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[bigeasy: Remove assumption about migrate_disable() from the description.]
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Priyanka Jain authored and Sebastian Andrzej Siewior committed Sep 13, 2021
1 parent 4df9e69 commit fe7f6c7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4891,7 +4891,7 @@ static int netif_rx_internal(struct sk_buff *skb)
struct rps_dev_flow voidflow, *rflow = &voidflow;
int cpu;

preempt_disable();
migrate_disable();
rcu_read_lock();

cpu = get_rps_cpu(skb->dev, skb, &rflow);
Expand All @@ -4901,14 +4901,14 @@ static int netif_rx_internal(struct sk_buff *skb)
ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);

rcu_read_unlock();
preempt_enable();
migrate_enable();
} else
#endif
{
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;
}
Expand Down

0 comments on commit fe7f6c7

Please sign in to comment.