Subject: Re: [PATCH net-next] tun: use per cpu variables for stats accounting

From: Paolo Abeni <[email-masked]>
Date: Fri, 15 Apr 2016 14:30:28 +0200

On Thu, 2016-04-14 at 22:56 -0400, David Miller wrote:
> From: Paolo Abeni <[email-masked]>
> Date: Wed, 13 Apr 2016 10:52:20 +0200
> 
> > Currently the tun device accounting uses dev->stats without applying any
> > kind of protection, regardless that accounting happens in preemptible
> > process context.
> > This patch move the tun stats to a per cpu data structure, and protect
> > the updates with  u64_stats_update_begin()/u64_stats_update_end() or
> > this_cpu_inc according to the stat type. The per cpu stats are
> > aggregated by the newly added ndo_get_stats64 ops.
> > 
> > Signed-off-by: Paolo Abeni <[email-masked]>
> 
> Ok this seems reasonable, applied, thanks.
> 
> I guess most applications use tuntap by having two threads, one
> for transmit and one for receive processing?

Probably. I guess that an user space application can leverage multiple
transmit threads to improve the throughput.

Paolo