diff options
author | Changli Gao <xiaosuo@gmail.com> | 2010-08-07 23:35:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-07 23:35:43 -0400 |
commit | cece1945bffcf1a823cdfa36669beae118419351 (patch) | |
tree | a3bd2c2a1953624b710524f56d98d7b1496f60a6 | |
parent | ba78e2ddca844598c0efcbf2c76d73519a61b902 (diff) |
net: disable preemption before call smp_processor_id()
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/dev.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 2b508966146b..1ae654391442 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2517,6 +2517,7 @@ int netif_rx(struct sk_buff *skb) | |||
2517 | struct rps_dev_flow voidflow, *rflow = &voidflow; | 2517 | struct rps_dev_flow voidflow, *rflow = &voidflow; |
2518 | int cpu; | 2518 | int cpu; |
2519 | 2519 | ||
2520 | preempt_disable(); | ||
2520 | rcu_read_lock(); | 2521 | rcu_read_lock(); |
2521 | 2522 | ||
2522 | cpu = get_rps_cpu(skb->dev, skb, &rflow); | 2523 | cpu = get_rps_cpu(skb->dev, skb, &rflow); |
@@ -2526,6 +2527,7 @@ int netif_rx(struct sk_buff *skb) | |||
2526 | ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); | 2527 | ret = enqueue_to_backlog(skb, cpu, &rflow->last_qtail); |
2527 | 2528 | ||
2528 | rcu_read_unlock(); | 2529 | rcu_read_unlock(); |
2530 | preempt_enable(); | ||
2529 | } | 2531 | } |
2530 | #else | 2532 | #else |
2531 | { | 2533 | { |