[RFC] Migrate network statistics to PCPU counters

Andrey V. Elsukov ae at FreeBSD.org
Sun Jun 30 09:49:30 UTC 2013


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.

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: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130630/6b09d45b/attachment.sig>


More information about the freebsd-arch mailing list