Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2592125imu; Mon, 19 Nov 2018 03:06:07 -0800 (PST) X-Google-Smtp-Source: AJdET5eRouXuIImGzcA15lOpbt/E2G4WstgzVtM8Dv0DB+14oJJ39yIR5BNHJrLsc34CxjNdpNC8 X-Received: by 2002:a63:dd15:: with SMTP id t21mr18966559pgg.347.1542625567184; Mon, 19 Nov 2018 03:06:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542625567; cv=none; d=google.com; s=arc-20160816; b=XRmeBvWMLMhgN6jTg648+D1Ca7OcEyE7CqchnihaQJwdiN8OPPMopdiz3vIpb7RdTE Th3Dv0uQ059Rz+nzdjbLZ1Vi730VJj81HF9EUqDo7MRoaHgDV2w06XUpNNcVEkT1ScA2 ViOW7zrW3+M1dis2ngH060g0Zmoo7E99GAPusWIoZvCCsCw+kyrWjtIhtltBSPqAyhS+ 3+TMLITNxYgHKD3cO4jSw+f9J2sLyjjMk+7DOUe3gxF45wJfXeWRp8GdPipGbYxYcDgL etVJQ17XPPdEtyxQM5mJaq0Ki0le6w3EnzFflRWf5dhyhNijv7J4yqh4/jztM4KIDCGA NCoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7l1Chv0HaZcS67irFF670F2vCwMmo9qIA4m1Am5X+0U=; b=WFzySYsjnM/DCapguf4+zOw88mTNQdDNqhdiVH0aRXr8v2yuRQo2Ymc4y585F10+yq DRHwK0Dy8CaMHQGfwGBxWZsM69aRUZ88hGxAZFr+a2CseQ+n5gnbw6GgLHn0u91TUPEY yCTZ0ha4FkPn57RLHRb6X0X/7U3UXkJwLmddTeAhYTC0cPaNpduBP0gH6GcOJ/5JWz2A PKJfQnruTKAnq9KsL0x3Me4zzc2YA1EMoBFB+HwxoJ2BUISjHtEH8RwJUskifozyoLh3 wh2TZXXWTCOe0qnDGQBjJo0wAn8L+7fLfO+mByDD+O74i9L4lLedsokxCmhaHBg68xpm NWFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12-v6si42104227pla.24.2018.11.19.03.05.52; Mon, 19 Nov 2018 03:06:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbeKSV1s (ORCPT + 99 others); Mon, 19 Nov 2018 16:27:48 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:41732 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbeKSV1s (ORCPT ); Mon, 19 Nov 2018 16:27:48 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 97A818084E; Mon, 19 Nov 2018 12:04:26 +0100 (CET) Date: Mon, 19 Nov 2018 12:04:28 +0100 From: Pavel Machek To: Bart Van Assche Cc: Andrew Morton , linux-kernel@vger.kernel.org, Vlastimil Babka , Mel Gorman , Christoph Lameter , Roman Gushchin Subject: Re: [PATCH] slab.h: Avoid using & for logical and of booleans Message-ID: <20181119110428.GE28607@amd> References: <20181105204000.129023-1-bvanassche@acm.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="N1GIdlSm9i+YlY4t" Content-Disposition: inline In-Reply-To: <20181105204000.129023-1-bvanassche@acm.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --N1GIdlSm9i+YlY4t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon 2018-11-05 12:40:00, Bart Van Assche wrote: > This patch suppresses the following sparse warning: >=20 > ./include/linux/slab.h:332:43: warning: dubious: x & !y >=20 > Fixes: 1291523f2c1d ("mm, slab/slub: introduce kmalloc-reclaimable caches= ") > Cc: Vlastimil Babka > Cc: Mel Gorman > Cc: Christoph Lameter > Cc: Roman Gushchin > Signed-off-by: Bart Van Assche > --- > include/linux/slab.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/include/linux/slab.h b/include/linux/slab.h > index 918f374e7156..97d0599ddb7b 100644 > --- a/include/linux/slab.h > +++ b/include/linux/slab.h > @@ -329,7 +329,7 @@ static __always_inline enum kmalloc_cache_type kmallo= c_type(gfp_t flags) > * If an allocation is both __GFP_DMA and __GFP_RECLAIMABLE, return > * KMALLOC_DMA and effectively ignore __GFP_RECLAIMABLE > */ > - return type_dma + (is_reclaimable & !is_dma) * KMALLOC_RECLAIM; > + return type_dma + is_reclaimable * !is_dma * KMALLOC_RECLAIM; > } > =20 What is wrong with && ? If logical and is better done by multiply, that's compiler job, and compiler should be fixed to do it... Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --N1GIdlSm9i+YlY4t Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlvymLwACgkQMOfwapXb+vILgACcCPHGg2P5wRydP+BaXyQGRzcL OXEAn28w7pdr0BinOx/fa+Yokkt4fC4X =Uw60 -----END PGP SIGNATURE----- --N1GIdlSm9i+YlY4t--