Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1232853imu; Mon, 5 Nov 2018 16:34:51 -0800 (PST) X-Google-Smtp-Source: AJdET5dWBS3fwOQ8e1bdW3tj0F285oD6azGP0WOQ8pwp1/0w1442NNZU1WAyIm52mhPH/R2yE65g X-Received: by 2002:a63:5558:: with SMTP id f24-v6mr19758612pgm.37.1541464491755; Mon, 05 Nov 2018 16:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541464491; cv=none; d=google.com; s=arc-20160816; b=eU6YsbRKJRf/4Y9ZfTs7dPnGZhCfxIz3MP0IwPuYI2G4TA5xe8AcQYfI5VkN2Usm+K xvjoendm1uObk1MdUyYsx09Wx6XsuR72rtKRBxODQbu7yiEbRYBfB+qMdkrAW9W1OCDm b5B0m+zR4XAtCy6HsZ13jWmYciBQq1z+Ar+IrUbdweTZD/+/B6Q6gPvbb36MOpqri9sq s+UxtBRQIpb5UGSJ0/U5tQ9Uh4mugScG3P6VEzgdRBddP5CsoICoY870Q0EthYjj/GPH lQEwJMDKPqDZIAqF3Q5cIBpVQIjZ6RBQiH9YAICqgUchOuXJERm0Q92lSSJvLl27LMvO aZ+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=biljzU61Ceh7QjOjGSZnVU9x0gpA9weTl6OrYDuZk9s=; b=AuE+BX9NSUmfKQgEodhrjcME57/kMOgmypWcrJecjNDr3Ii3hTrwsaAWS4G5haH84U nt2PzYlIQyQQPevVLH09NsxZexfWFnqjCwfhQKaVrIgu/jJczJSO0BBr+t0P+mAxk3Hc 1DV4WtU7x6qDno5SG+HFyflwZS768gZP1Jy+Y1aoj/43RY6UsY0wCH/nXApCa+gy1IYP MdM1Q7ANVkgEwbNXVYnmifeaxr8FgbpcKxAV7nU3xXXctkHknQB3cm/deRy009bPj7j7 a5xYbh2Bl2Rv40vmLL84QZq7+3KQkJRAube7R/mbIKchBujbgn3IaNGKPoiDCcywmASs wkhA== 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 1-v6si15437971plw.81.2018.11.05.16.34.35; Mon, 05 Nov 2018 16:34:51 -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 S1729241AbeKFJzS (ORCPT + 99 others); Tue, 6 Nov 2018 04:55:18 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36385 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbeKFJzS (ORCPT ); Tue, 6 Nov 2018 04:55:18 -0500 Received: by mail-pf1-f195.google.com with SMTP id j22-v6so5256160pfh.3 for ; Mon, 05 Nov 2018 16:32:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=biljzU61Ceh7QjOjGSZnVU9x0gpA9weTl6OrYDuZk9s=; b=ohwf+FCc7YRXUvBsSHstnTiDD67NhbT9YUypYy2tOix6TDtPBa5O6xQ5CO/kGbIEJa i44fCmsT/wJkVYj5Gc9tOvEP0TKU68qC3vUSwPnVT0/hSFfiSQXG/qcFOe/7sMqtDe8q JnIIoYkH0HPs0ntlC54WGUKwRCTFkxhlfHWBg2IYxBTIIAC/gWtgPGWrSTEsC01G1JjC TTuIqBW8goqL/Y49fv5jh80udrJLwVDU56rJOU45lGyeMNRi5Dujt539iBv2tj2GPEy5 SJD4g+SgRoAnlqOLjQOssL2l73ca6ioyrARyj2dFDyyJEQ69oiTXPDuI2z9G8FVBFuq/ KFow== X-Gm-Message-State: AGRZ1gK4MKrHAt/Uo/aD42igUM7apLm69kYf9QeoxQp29H/ygaqG5In+ VqO06Eow12KboIEIF047YfE= X-Received: by 2002:a63:1412:: with SMTP id u18mr21460242pgl.247.1541464372634; Mon, 05 Nov 2018 16:32:52 -0800 (PST) Received: from ?IPv6:2620:15c:2cd:203:5cdc:422c:7b28:ebb5? ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id b29-v6sm78606642pfj.183.2018.11.05.16.32.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 Nov 2018 16:32:52 -0800 (PST) Message-ID: <1541464370.196084.166.camel@acm.org> Subject: Re: [PATCH] slab.h: Avoid using & for logical and of booleans From: Bart Van Assche To: Alexander Duyck Cc: linux@rasmusvillemoes.dk, Andrew Morton , LKML , Vlastimil Babka , Mel Gorman , Christoph Lameter , guro@fb.com, Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm Date: Mon, 05 Nov 2018 16:32:50 -0800 In-Reply-To: References: <20181105204000.129023-1-bvanassche@acm.org> <20181105131305.574d85469f08a4b76592feb6@linux-foundation.org> <1541454489.196084.157.camel@acm.org> <1541457654.196084.159.camel@acm.org> <1541462466.196084.163.camel@acm.org> Content-Type: text/plain; charset="UTF-7" X-Mailer: Evolution 3.26.2-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2018-11-05 at 16:11 -0800, Alexander Duyck wrote: +AD4 If we really don't care then why even bother with the switch statement +AD4 anyway? It seems like you could just do one ternary operator and be +AD4 done with it. Basically all you need is: +AD4 return (defined(CONFIG+AF8-ZONE+AF8-DMA) +ACYAJg (flags +ACY +AF8AXw-GFP+AF8-DMA)) ? KMALLOC+AF8-DMA : +AD4 (flags +ACY +AF8AXw-GFP+AF8-RECLAIMABLE) ? KMALLOC+AF8-RECLAIM : 0+ADs +AD4 +AD4 Why bother with all the extra complexity of the switch statement? I don't think that defined() can be used in a C expression. Hence the IS+AF8-ENABLED() macro. If you fix that, leave out four superfluous parentheses, test your patch, post that patch and cc me then I will add my Reviewed-by. Bart.