From owner-svn-src-head@freebsd.org Fri Nov 24 13:25:02 2017 Return-Path: Delivered-To: svn-src-head@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 DE70CDE5662; Fri, 24 Nov 2017 13:25:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E3FB743B2; Fri, 24 Nov 2017 13:25:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id vAODOr4Y037971 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 24 Nov 2017 15:24:54 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua vAODOr4Y037971 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id vAODOrM2037970; Fri, 24 Nov 2017 15:24:53 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Nov 2017 15:24:53 +0200 From: Konstantin Belousov To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r326073 - head/usr.bin/systat Message-ID: <20171124132453.GY2272@kib.kiev.ua> References: <201711211955.vALJtWhg047906@repo.freebsd.org> <20171122071838.R1172@besplex.bde.org> <20171122103917.GS2272@kib.kiev.ua> <20171123021646.M1933@besplex.bde.org> <20171122220538.GT2272@kib.kiev.ua> <20171123224032.A992@besplex.bde.org> <20171123151849.GU2272@kib.kiev.ua> <20171124184535.E980@besplex.bde.org> <20171124105720.GW2272@kib.kiev.ua> <20171124225011.V1289@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171124225011.V1289@besplex.bde.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Nov 2017 13:25:03 -0000 On Sat, Nov 25, 2017 at 12:14:10AM +1100, Bruce Evans wrote: > On Fri, 24 Nov 2017, Konstantin Belousov wrote: > > > On Fri, Nov 24, 2017 at 08:15:06PM +1100, Bruce Evans wrote: > >> On Thu, 23 Nov 2017, Konstantin Belousov wrote: > >* ... > >>>> #define pgtok(p) ((uintmax_t)(p) * pageKilo) > >>> Amusingly there is already MD macro in machine/param.h with the same name > >>> and same intent, but as you formulate it, sloppy implementation. It uses > >>> unsigned long cast on almost all 64bit arches, except powerpc. For 32bit > >>> arches, the cast is not done, unfortunately. > >> > >> I already pointed out the system pgtok(). > >> > >> It was almost correct to cast to u_int on all arches because the > >> implementation can know the size of all its page counters. That was int > >> or u_int, and the expansion factor is small. In practice, 32-bit systems > >> never have enough memory to overflow in K (that happens at 4TB), and > >> 64-bit systems that overflow in K are close to overflowing the page > >> counters (that happens at 16TB with 4K-pages). > >> > >> The pgtok() is just unusable because the page size can vary. > > No, it is unusable only due to the implementation not ensuring the consistent > > output type. > > Hmm, I couldn't find any arch with even a compile-time variable PAGE_SIZE. > It is currently just unportable in theory to use hard-coded PAGE_SIZE or > macros that use it. sparc64 uses 8K, Itanium had compile-time variable page size supported by hardware.