mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 16:54:21 +00:00 
			
		
		
		
	[NET]: Can use __get_cpu_var() instead of per_cpu() in loopback driver.
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 <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									78d7942317
								
							
						
					
					
						commit
						58f539740b
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -153,14 +153,14 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| #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; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Eric Dumazet
						Eric Dumazet