[RFC] Migrate network statistics to PCPU counters

Konstantin Belousov kostikbel at gmail.com
Sun Jun 30 17:54:02 UTC 2013


On Sun, Jun 30, 2013 at 01:46:25PM +0400, Andrey V. Elsukov wrote:
> Hi All,
> 
> A quite time we have in the tree implementation of the percpu counters.
> The usage of PCPU counters shows better performance and precision, most
> notably on the machines with many CPUs.
> 
> I prepared several patches, that moves most of statistics structures in
> the network stack to the PCPU counters. These patches can be divided to
> the three parts:
> 
>   1. Prepare all structures to migration. In most cases this is similar
> to  s/some_type_t/uint64_t/
>   2. Add several macros to reduce the code rewriting.
>   3. Migrate all structures to PCPU counters.
> 
> Since first part breaks ABI, I want to commit these patches to the head/
> before stable/10 will be created. This is the list of structures:
> 
> ahstat, espstat, ipcompstat, ipipstat, ipsec4stat, ipsec6stat,
> pfkeystat, mrtstat, pimstat, arpstat, ip6stat, icmp6stat, in6_ifstat,
> icmp6_ifstat, rip6stat, pim6stat, mrt6stat, udpstat.
> 
> ipstat and tcpstat already moved to PCPU counters, I just updated
> implementation. Also there is several structures I didn't touch, e.g.
> igmpstat, sctpstat.
> 
> The second part of patches adds several helper macros to sys/counter.h
> and net/vnet.h. The main idea is that we declare array of counter_u64_t
> with number of elements equal to number of uint64_t elements in the
> stats structure and use offsetof() to get access to needed counter. In
> the same time, the stats structure used as interface with userland.
Only reacting to the last sentence.

I think this is notoriously bad, the in-kernel interfaces and usermode ABI
should be split.  The reuse of the structures for kernel and for interfacing
to usermode is the reason why we cannot ensure the stability of the
management ABI even on stable.

I suggest to not doing this, instead having the dedicated definitions for
user mode, and also to add padding to the usermode interface for future
extensions.

> 
> All patches can be found here:
> 
> 	http://people.freebsd.org/~ae/stats/
> 
> I didn't do any benchmarks yet, for now I just want to discuss
> implementation and acceptability of these patches.
> 
> -- 
> WBR, Andrey V. Elsukov
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130630/b6b9c625/attachment.sig>


More information about the freebsd-arch mailing list