netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: disable preemption before call smp_processor_id()
@ 2010-08-07  9:26 Changli Gao
  2010-08-08  3:37 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Changli Gao @ 2010-08-07  9:26 UTC (permalink / raw)
  To: David S. Miller; +Cc: Paul E. McKenney, Tom Herbert, netdev, Changli Gao

Although netif_rx() isn't expected to be called in process context with
preemption enabled, it'd better handle this case. And this is why get_cpu()
is used in the non-RPS #ifdef branch. If tree RCU is selected,
rcu_read_lock() won't disable preemption, so preempt_disable() should be
called explictly.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/core/dev.c |    2 ++
 1 file changed, 2 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 2b50896..1ae6543 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2517,6 +2517,7 @@ int netif_rx(struct sk_buff *skb)
 		struct rps_dev_flow voidflow, *rflow = &voidflow;
 		int cpu;
 
+		preempt_disable();
 		rcu_read_lock();
 
 		cpu = get_rps_cpu(skb->dev, skb, &rflow);
@@ -2526,6 +2527,7 @@ int netif_rx(struct sk_buff *skb)
 		ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail);
 
 		rcu_read_unlock();
+		preempt_enable();
 	}
 #else
 	{

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-08  5:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-07  9:26 [PATCH] net: disable preemption before call smp_processor_id() Changli Gao
2010-08-08  3:37 ` David Miller
2010-08-08  4:57   ` Paul E. McKenney
2010-08-08  5:25     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).