From owner-freebsd-arch@FreeBSD.ORG Sun Jun 30 09:49:30 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by hub.freebsd.org (Postfix) with ESMTP id 992059AB; Sun, 30 Jun 2013 09:49:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id 9039D4E35; Sun, 30 Jun 2013 09:49:28 +0000 (UTC) Message-ID: <51CFFE71.9080802@FreeBSD.org> Date: Sun, 30 Jun 2013 13:46:25 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: freebsd-arch@freebsd.org Subject: [RFC] Migrate network statistics to PCPU counters X-Enigmail-Version: 1.4.6 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigB504481EDEFC3CE9845874F7" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jun 2013 09:49:30 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigB504481EDEFC3CE9845874F7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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. --=20 WBR, Andrey V. Elsukov --------------enigB504481EDEFC3CE9845874F7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJRz/52AAoJEAHF6gQQyKF6S+sH/3FIsf4kBoGQHXDnweKm4Sev OhvHIGc4OsKuW24NUdPqNORafjCXzPOQc4Hk761c5t6cRBnrFvtM+1ulS0K8gqmD AN1U6XNnwyKDyvmO/8zQBEGCROeSV4Lb6ejmFuIfm9zixPSekOJJmZkbtevxIwal NOAxY5ghK+yOrX3hz/WJqo2t51Dcw1pfGS/CV1MvwRMvw/L5ASMZ6mhv277MezXe AByOB//lZo3SS1R1bHWkv2yhkZNbSuTKplSGeGS9+QYUrU2ioJ9wFKEQCtJFBhUT +67kOm1bTErH4qpXrI65YjbS5fsFna2A5QmXxzQQ6QxnsMUX5kSpk5O/OTLUB9U= =6000 -----END PGP SIGNATURE----- --------------enigB504481EDEFC3CE9845874F7--