As BHs are off in loopback_xmit(), preemption cannot occurs, so we can use __get_cpu_var() instead of per_cpu() (and avoid a preempt_enable()/preempt_disable() pair)

Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>

--- net-2.6/drivers/net/loopback.c      2006-10-19 16:46:27.000000000 +0200
+++ net-2.6-ed/drivers/net/loopback.c      2006-10-20 09:11:04.000000000 +0200
@@ -153,14 +153,14 @@
 #endif
        dev->last_rx = jiffies;
 
-       lb_stats = &per_cpu(pcpu_lstats, get_cpu());
+       /* it's OK to use __get_cpu_var() because BHs are off */
+       lb_stats = &__get_cpu_var(pcpu_lstats);
        lb_stats->bytes += skb->len;
        lb_stats->packets++;
-       put_cpu();
 
        netif_rx(skb);
 
-       return(0);
+       return 0;
 }
 
 static struct net_device_stats loopback_stats;

Reply via email to