Skip to content

Commit

Permalink
net/core: use local_bh_disable() in netif_rx_ni()
Browse files Browse the repository at this point in the history
In 2004 netif_rx_ni() gained a preempt_disable() section around
netif_rx() and its do_softirq() + testing for it. The do_softirq() part
is required because netif_rx() raises the softirq but does not invoke
it. The preempt_disable() is required to remain on the same CPU which added the
skb to the per-CPU list.
All this can be avoided be putting this into a local_bh_disable()ed
section. The local_bh_enable() part will invoke do_softirq() if
required.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Sebastian Andrzej Siewior committed Sep 13, 2021
1 parent d9560a7 commit 9c7e349
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4943,11 +4943,9 @@ int netif_rx_ni(struct sk_buff *skb)

trace_netif_rx_ni_entry(skb);

preempt_disable();
local_bh_disable();
err = netif_rx_internal(skb);
if (local_softirq_pending())
do_softirq();
preempt_enable();
local_bh_enable();
trace_netif_rx_ni_exit(err);

return err;
Expand Down

0 comments on commit 9c7e349

Please sign in to comment.