]> git.baikalelectronics.ru Git - kernel.git/commit
tun: use per cpu variables for stats accounting
authorPaolo Abeni <pabeni@redhat.com>
Wed, 13 Apr 2016 08:52:20 +0000 (10:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Apr 2016 02:55:25 +0000 (22:55 -0400)
commitae860104cbe7516cead974061a34851812995df7
treeaff52e194edf2b83aebf0c668741c070094430cf
parentad251feed799c74d415ff8e4fc79481cdc68b798
tun: use per cpu variables for stats accounting

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 <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c