Date: Tue, 5 Jun 2018 16:02:16 -0700 From: Gleb Smirnoff <glebius@FreeBSD.org> To: Mateusz Guzik <mjguzik@gmail.com> Cc: Eric van Gyzen <eric@vangyzen.net>, Mateusz Guzik <mjg@freebsd.org>, src-committers <src-committers@freebsd.org>, 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: <20180605230216.GD1005@FreeBSD.org> In-Reply-To: <CAGudoHGeEYZV2Cnxh8AYoReWpJRD0VRkaNTAMd=B_3%2Bz7E2UOA@mail.gmail.com> References: <201806022220.w52MK9TT026244@repo.freebsd.org> <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net> <CAGudoHGcZ9b8fvQVx-%2Bxqsr47GzrTZR6%2Bh2C_EqTp3rSjGvATw@mail.gmail.com> <20180605225215.GC1005@FreeBSD.org> <CAGudoHGeEYZV2Cnxh8AYoReWpJRD0VRkaNTAMd=B_3%2Bz7E2UOA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 06, 2018 at 12:56:47AM +0200, Mateusz Guzik wrote: M> > M> Thank you for the kind words. It is positive feedback like this which M> > M> keeps me going! M> > M> > Btw, what was the point of checking flags || result? Most places in kernel M> > ignore flags and just test result regerdless of M_WAITOK/M_NOWAIT. M> > M> > The result is already in a register, why do you think checking for absense M> > of M_WAITOK is faster that checking for !NULL _malloc_item? M> > M> M> This part is only reachable if flags are known at compilation time. If they M> contain M> M_WAITOK, the flag check will get elided along (we know for a fact it M> passes) M> and subsequently the NULL check will be short circuited, iow for known M> M_WAITOK|M_ZERO flags this is: M> M> _malloc_item = malloc(_size, type, flags & ~ M_ZERO); M> bzero(_malloc_item, _size); Thanks a lot for explanation! -- Gleb Smirnoff
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180605230216.GD1005>