From owner-svn-src-stable@freebsd.org Tue Apr 26 21:16:08 2016 Return-Path: Delivered-To: svn-src-stable@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 84446B1D612 for ; Tue, 26 Apr 2016 21:16:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm7.bullet.mail.bf1.yahoo.com (nm7.bullet.mail.bf1.yahoo.com [98.139.212.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F6D31ECA for ; Tue, 26 Apr 2016 21:16:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1461705360; bh=pNchczr3H6lOqe6Y3FsiODvArGy3z5oxmB97bFcVTkc=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=Hisxg2+P6AjT5LVTUfLxoH14imyD/ql0mbb0Rmmcks+qlb4Ddws8OFYbxnidzlbMA0BfhE+lC/00CP09EUpcUYenOfJWGAnARw9MHGVN6nauxhk99i88f8Xp/YwnEtEtNo1cTCDDzdY4CApyEyJx0pXuhoCHBoe46bd8GKlD21FUkmLtsVEHkvDdtTh3PVsoMOfawxoAZxAD1CCSUAVkGHPmZml54rIETyCuhhOOZD2NfqJD2zX8uU3SNtAiAWNBLqvur3spoEm0f5IogioRFQTBV6GbuO3YRI63v/TO52Nlghoe7tDkqmHzqJeTgQUrfwJP+4eZkDQXRsTYZRm0Jg== Received: from [98.139.215.142] by nm7.bullet.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 21:16:00 -0000 Received: from [98.139.211.206] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 21:16:00 -0000 Received: from [127.0.0.1] by smtp215.mail.bf1.yahoo.com with NNFMP; 26 Apr 2016 21:16:00 -0000 X-Yahoo-Newman-Id: 686161.49640.bm@smtp215.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: g6C0DUYVM1mqQopVA9lVAxBdXnCS9Xkaqo4CP6.4ZxVDyUT I_YnyrZIsUW6bV3DPhK602iOIkNF16jE8lTPq22Clr5FoYDcx.zMyBxmOu4p rZeN13p4yeKwpU9SBLpCaofAEi3ZxA.GeIqO5gVios.vZyk8FN0iboAgDqXw yvV3aXEOLJAzeKsLSWxEGqIa9w_H5TeLwUrAnztm0NNwRJ3QDR0cc58hRFWs 1d2mFcnybutUo.AnIR0gIvuqRY8vXfb38G.k.fOk2PIqA6GHPVZPqVSi9gD0 UhXm9s_bLAsxRG114wKiENkF5umcmj7Ff52vzsqgkBrRX99PXMJWFutmSqz0 VbM49E_PO2q309R6uUSFjS.RgwuZkoCfx7TIXcUA6SR8eOKEU5fCNo2cNYYe 5HXdGWWvrGEvuoOnyRuzTZioVvyajKIgJoNrMOfNOq0zwuT3V3ft2EIj_0zU giIqGFuAEYnft0DDdD.Vn0DdmE3hGAqU7nTbUbCIVJSVzqI9ZfEnPIc3onny xINrzb5YVoJOkHOwJHs9XHmmGr1_AyQ4i X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn: stable/10/sys: amd64/amd64 amd64/linux amd64/linux32 compat/linux dev/cxgbe/tom i386/linux vm To: Maxim Sobolev References: <201604261739.u3QHdtSd082499@repo.freebsd.org> <64931143-1496-56b9-8dc7-f11cbb0c06ed@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org From: Pedro Giffuni Message-ID: <7d17cf67-284d-0b8f-6ab7-83422e386a21@FreeBSD.org> Date: Tue, 26 Apr 2016 16:16:15 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2016 21:16:08 -0000 Just IMHO; It is probably too much trouble to pretend to add such checks to the macros. People using them should know to avoid division by zero and other issues that may happen. Pedro. On 04/26/16 14:59, Maxim Sobolev wrote: > Yeah, sure no rush. Another interesting mode of failure to check in > howmany(X, S) is KASSERT((X % S) == 0). There might be few cases when > it's intended behaviour, but for majority of them it should be > indication of some kind of programmatic error (i.e. missing a cast in > sizeof and getting void * size instead of the structure size). Those > which rely on rounding could then be separated into howmany_rup() > and howmany_rdown() or something. > > On Tue, Apr 26, 2016 at 12:04 PM, Pedro Giffuni > wrote: > > Hello > > On 04/26/16 13:42, Maxim Sobolev wrote: > > Given the widespread use of those two macros, maybe we need > howmany.9 > and roundup.9 manual pages with detailed formal description? > Particularly interested in how "return" supposed to be typed. > Another > thing is that would be nice is some kind of automatic > #error/#warning/printf/KASSERT/panic when (X < Y || Y <= 0) & > defined(INVARIANTS). > > -Max > > > I agree, we need those documented. There's also rounddown, roundup2 and > rounddown2. > > FWIW, I am tired of these massive replacements, and will likely take > a break before trying rounddown. > > Pedro. > > On Tue, Apr 26, 2016 at 10:39 AM, Pedro F. Giffuni > > >> wrote: > > Author: pfg > Date: Tue Apr 26 17:39:54 2016 > New Revision: 298653 > URL: https://svnweb.freebsd.org/changeset/base/298653 > > Log: > MFC r298482: > Cleanup redundant parenthesis from existing > howmany()/roundup() > macro uses. > > Requested by: dchagin > > Modified: > stable/10/sys/amd64/amd64/pmap.c > stable/10/sys/amd64/linux/linux_sysvec.c > stable/10/sys/amd64/linux32/linux32_sysvec.c > stable/10/sys/compat/linux/linux_file.c > stable/10/sys/dev/cxgbe/tom/t4_tom.c > stable/10/sys/i386/linux/linux_sysvec.c > stable/10/sys/vm/vm_radix.c > Directory Properties: > stable/10/ (props changed) > > >