From owner-svn-src-head@freebsd.org Tue Jun 5 16:35:39 2018 Return-Path: Delivered-To: svn-src-head@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 38AF9FD4B80; Tue, 5 Jun 2018 16:35:39 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x22c.google.com (mail-qt0-x22c.google.com [IPv6:2607:f8b0:400d:c0d::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C974F83160; Tue, 5 Jun 2018 16:35:38 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x22c.google.com with SMTP id i18-v6so3062241qtp.12; Tue, 05 Jun 2018 09:35:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LHBLlzwwMhZsFB5SZJMJvDv5w9NOlOUQgdwWu2Si4Qk=; b=UJ4RyJm0ZE0RO0bt75pqf6hh0Pi+Hf5aqYQo+StXqJw3YxVF26lJXh+XAe4bUJdUDb HztlDL/fBPI2jVMwA7Ae4b4+3UbS3e43aDUB0A3DDR/Yv7rINEDBH5Nl6rZnG24VDVu2 inFyoOznxPthoRVILzQOor8V061lPWCNeKNheBQIJbWwLtrHUbVAJotdZi/ROaysxRwD fnyvNT/5XLMsOJWyWimvoT+R5N/nUqgWpxMdAUjrxHeJnAShLAWSpB+IkRJvVOa3f2GG Zr1Rw5x66Vx3yE8Cw5hbbzvoANX7wi/f1ofs4gTUumcmY3k2Og5Az51hg0nn4QC6xFNW KwhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LHBLlzwwMhZsFB5SZJMJvDv5w9NOlOUQgdwWu2Si4Qk=; b=ZdSp1qVOmiZWRLVUseZUSNiSPx0aScFoZkN7K/RtKw3PmL6ZyzmgNc56kkr1orbKlm vdLoKOOLC8hmbJwCSb4iaMB8WquDvzF9wOvj4i4x1IbDisYyF7gejSGcD7N3zmQOJj0i u2r9RP+KlIZCQPHbXLSxDOg76Jh6B58NpbawBRPVFYZP990HgepWK1wU7LIydDKCS4yU nm5pElHExn28LL7WPzwRQ07Bby01d69fUj+MGQw7pSRHI62ZMoZKbt1iUQPWJepSwKam VPLf+L/XfGYGWw46PlW7YXlm7HrKiX7Vqk+UO2Z3n6c1YvgrrsgU/gA2upkhPMjlnmDb rtPw== X-Gm-Message-State: APt69E0BrcF7uiOk2Ld38HdNUSTQ3lkGZ/cHJNxasukDHOqm/ufZBFO9 mgDfN44BIhB8pkozDq09v5TFpdMAF1uKkwH5rxc= X-Google-Smtp-Source: ADUXVKLFilGCb7necOOoIsuQoTpRRYMM35TaD7lMAi2WfJxKI5t/vM7YnwZPAZoPfCnKhozo2tPODbkLYHEwr7nHwaE= X-Received: by 2002:ac8:34aa:: with SMTP id w39-v6mr24442305qtb.237.1528216538401; Tue, 05 Jun 2018 09:35:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:1c4e:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 09:35:37 -0700 (PDT) In-Reply-To: <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net> References: <201806022220.w52MK9TT026244@repo.freebsd.org> <1b77e282-e24b-d14c-9811-4cf214d58280@vangyzen.net> From: Mateusz Guzik Date: Tue, 5 Jun 2018 18:35:37 +0200 Message-ID: Subject: Re: svn commit: r334545 - in head/sys: contrib/zstd/lib/freebsd kern netinet/libalias sys To: Eric van Gyzen Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 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: Tue, 05 Jun 2018 16:35:39 -0000 On Tue, Jun 5, 2018 at 5:38 PM, Eric van Gyzen wrote: > On 06/02/2018 17:20, Mateusz Guzik wrote: > > +#ifdef _KERNEL > > +#define malloc(size, type, flags) ({ \ > > + void *_malloc_item; \ > > + size_t _size = (size); \ > > + if (__builtin_constant_p(size) && __builtin_constant_p(flags) &&\ > > + ((flags) & M_ZERO)) { \ > > + _malloc_item = malloc(_size, type, (flags) &~ M_ZERO); \ > > + if (((flags) & M_WAITOK) || _malloc_item != NULL) \ > > + bzero(_malloc_item, _size); \ > > + } else { \ > > + _malloc_item = malloc(_size, type, flags); \ > > + } \ > > + _malloc_item; \ > > +}) > > +#endif > > Mateusz, > > Thank you for this and for all of your performance work. It is all very > interesting stuff. > > Thank you for the kind words. It is positive feedback like this which keeps me going! > Coverity complains about this line: > > if (((flags) & M_WAITOK) || _malloc_item != NULL) > > saying: > > The expression > 1 /* (2 | 0x100) & 2 */ || _malloc_item != NULL > is suspicious because it performs a Boolean operation > on a constant other than 0 or 1. > > Would you mind adding != 0 to appease Coverity? > Please go ahead. -- Mateusz Guzik