OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 1/4] net: Dynamically allocate the per cpu counters for the loopback device.
Re: [PATCH 1/4] net: Dynamically allocate the per cpu counters for the loopback device. [message #20863 is a reply to message #20851] Thu, 27 September 2007 05:09 Go to previous messageGo to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Wed, 26 Sep 2007 17:53:40 -0600

> 
> This patch add support for dynamically allocating the statistics counters
> for the loopback device and adds appropriate device methods for allocating
> and freeing the loopback device.
> 
> This completes support for creating multiple instances of the loopback
> device,  in preparation for creating per network namespace instances.
> 
> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>

Applied to net-2.6.24, thanks.

> @@ -155,7 +154,8 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
>  	dev->last_rx = jiffies;
>  
>  	/* it's OK to use __get_cpu_var() because BHs are off */
> -	lb_stats = &__get_cpu_var(pcpu_lstats);
> +	pcpu_lstats = netdev_priv(dev);
> +	lb_stats = per_cpu_ptr(pcpu_lstats, smp_processor_id());
>  	lb_stats->bytes += skb->len;
>  	lb_stats->packets++;
>  

I'm going to add a followon change that gets rid of that
comment about __get_cpu_var() since it is no longer
relevant.
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH] various dst_ifdown routines to catch refcounting bugs
Next Topic: [PATCH] netns: CLONE_NEWNET don't use the same clone flag as the pid namespace.
Goto Forum:
  


Current Time: Wed Oct 08 00:07:39 GMT 2025

Total time taken to generate the page: 0.13766 seconds