Date: Mon, 11 Sep 2017 20:01:23 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Mateusz Guzik <mjguzik@gmail.com> Cc: Ryan Libby <rlibby@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, Mateusz Guzik <mjg@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org> Subject: Re: svn commit: r323393 - in head/sys: sys vm Message-ID: <20170911193618.V1292@besplex.bde.org> In-Reply-To: <CAGudoHH=nGMPwiLJ_bb5OhEjN_u6S=P16snyEUah5i7MzGQmnA@mail.gmail.com> References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> <CAGudoHG8yVw46cwmpswnozMf-pSjHtBXHDk8DmJ6v=CwOCvWLg@mail.gmail.com> <CAHgpiFx-M3=JtZ0iq4CoxoEPMdDUYBS3W5SMaUntkBZZziqGjQ@mail.gmail.com> <CAGudoHH=nGMPwiLJ_bb5OhEjN_u6S=P16snyEUah5i7MzGQmnA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 11 Sep 2017, Mateusz Guzik wrote: > On Mon, Sep 11, 2017 at 10:24 AM, Ryan Libby <rlibby@freebsd.org> wrote: > >> On Mon, Sep 11, 2017 at 12:30 AM, Mateusz Guzik <mjguzik@gmail.com> wrote: >> [...] >>> That said, looking now at the struct I think its use should be retired >>> from the kernel. It can remain in headers for userspace use. More about this in another reply. >>> First, there is a bunch of counter(9) fields. I don't know the original >>> reasoning. I would expect these counters to be statically defined in a >>> per-cpu struct. Changing them to 64 bits was even larger ABI breakage (they could have been replaced by padding so that they read as 0's but don't break all following fields). >> The actual counter(9) counters are per-CPU. These are just offsets into >> the PCPU area. See r317061 / D10156 (recent work by glebius). > > I mean their ids are allocated on boot, even though these counters are > always present and could be resolved at compilation time. So in order > to update them you have to fetch the id, as opposed to having the code > just do the right thing. > > I.e. for stuff which is always there we should just have well known offsets > into per-cpu tables. But I'm not going to try to flame a patch in (or write > one). vmstat(1) has the necessary support to read the counters from dead kernels. systat(1) is simpler because it doesn't support dead kernels. It just uses the horrible GETSYSCTL() macro/implementation. vmstat uses the horrible GET_VM_STATS() macro/implementation instead. The horribleness of these includes different bad error handling. vmstat aborts if a sysctl no longer exists or has changed it size. This gives much the same breakage as an ABI change. systat only spams the window with an error message. This is relatively harmless. Sometimes the error message even remains visible so it explains why some fields are displayed as always 0. The change of the size for the counters was eventually fixed in both vmstat and systat by changing the kernel to use the application's size in some cases. I don't care about dead kernels. Thus, moving the fields doesn't break anything for me. It "only" takes about 10000 instructions per field read to handle the move automatically using sysctl(). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170911193618.V1292>