From owner-svn-src-all@freebsd.org Fri Jun 8 23:58:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AEC0EFDDE39; Fri, 8 Jun 2018 23:58:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [198.45.61.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3783377AB0; Fri, 8 Jun 2018 23:58:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id w55MqFDP001459 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 5 Jun 2018 15:52:16 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w55MqF2B001458; Tue, 5 Jun 2018 15:52:15 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 5 Jun 2018 15:52:15 -0700 From: Gleb Smirnoff To: Mateusz Guzik Cc: Eric van Gyzen , Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys Message-ID: <20180605225215.GC1005@FreeBSD.org> References: <201806022220.w52MK9TT026244@repo.freebsd.org> <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 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: Fri, 08 Jun 2018 23:58:59 -0000 On Tue, Jun 05, 2018 at 06:35:37PM +0200, Mateusz Guzik wrote: M> > On 06/02/2018 17:20, Mateusz Guzik wrote: M> > > +#ifdef _KERNEL M> > > +#define malloc(size, type, flags) ({ \ M> > > + void *_malloc_item; \ M> > > + size_t _size = (size); \ M> > > + if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\ M> > > + ((flags) & M_ZERO)) { \ M> > > + _malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \ M> > > + if (((flags) & M_WAITOK) || _malloc_item != NULL) \ M> > > + bzero(_malloc_item, _size); \ M> > > + } else { \ M> > > + _malloc_item = malloc(_size, type, flags); \ M> > > + } \ M> > > + _malloc_item; \ M> > > +}) M> > > +#endif M> > M> > Mateusz, M> > M> > Thank you for this and for all of your performance work. It is all very M> > interesting stuff. M> > M> > M> Thank you for the kind words. It is positive feedback like this which M> keeps me going! Btw, what was the point of checking flags || result? Most places in kernel ignore flags and just test result regerdless of M_WAITOK/M_NOWAIT. The result is already in a register, why do you think checking for absense of M_WAITOK is faster that checking for !NULL _malloc_item? -- Gleb Smirnoff