From owner-svn-src-all@freebsd.org Mon Sep 11 10:24:06 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 815B5E02C47; Mon, 11 Sep 2017 10:24:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id C235E7F463; Mon, 11 Sep 2017 10:24:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 1E4DF10793C; Mon, 11 Sep 2017 20:01:24 +1000 (AEST) Date: Mon, 11 Sep 2017 20:01:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mateusz Guzik cc: Ryan Libby , Bruce Evans , Mateusz Guzik , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r323393 - in head/sys: sys vm In-Reply-To: Message-ID: <20170911193618.V1292@besplex.bde.org> References: <201709101900.v8AJ0c2N059845@repo.freebsd.org> <20170911111127.B870@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=KeqiiUQD c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=pGLkceISAAAA:8 a=BmAKPIbiGlEMQsjAth0A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=6kGIvZw6iX1k4Y-7sg4_:22 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Sep 2017 10:24:06 -0000 On Mon, 11 Sep 2017, Mateusz Guzik wrote: > On Mon, Sep 11, 2017 at 10:24 AM, Ryan Libby wrote: > >> On Mon, Sep 11, 2017 at 12:30 AM, Mateusz Guzik 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