Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4381746pxb; Tue, 2 Mar 2021 13:49:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxppdxjvM9JwaodvXO7fxNXxhTxPuFvXdtkxjAakSvuOW4QHgNrBQTPdVGVTtHDLHhluLI2 X-Received: by 2002:a17:907:36e:: with SMTP id rs14mr22357019ejb.42.1614721769078; Tue, 02 Mar 2021 13:49:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614721769; cv=none; d=google.com; s=arc-20160816; b=q+cPsJRo29+nMZgmb+4UQhGT0ZLgucQeATbNUFWaDabIq9wyBHWXq/+9QFFQVXcWWo sRW8yRcvPoO3KtJRdmZIOCnnPrUSq+F4Ay3NXzrOvPQXIJRkKfctcFQSNzYS0AG0DexW 9Byq59zXDFlDqQNQVOWIFFiYOkxlO10kMR8dRHogCnWLNtBdkK31ve/5gg8YP6lzhzVm /FNLT44a+xNLT3hezt1zVSIyhegbtybp6Vp8ENjSkpqgB9+NnGmPjExiLC/Wf67VhmKy aLZapvn1JFahUKweLHN830R7jB3FYmfGm2kxp9qJiiolcnSTfw3Lfe9nbHm6myq9WHT1 9R2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=G5XxWD3JTih2YFKDPW5pChv40ZsAmXckawtWTxCNdHM=; b=nQraPPIhQO0lDauPAPd3Bj0arOgNZgqDzesnkxHcS+HJi32u6crTpdHdbAlEBAw2Ne DXmmvk+iRy4KVLOEZnD50Z7GBpQ9LuBcoB62yA3Gcwrky9m178h1QxjQRdGe/Jq3EofR j3g9QvLDSdGd/TWPbsRLdcWX0w4htokew9x7EZFafnkI9uuoZ0nxAd8fhSK53nOYskWA on425/+4vDD7vEXyJIQ/tgdIcZXBjoPI8AeCAde+DyDx4XNX5BLUZBN3YeIgRFtBJ3iq vlUE3lJgGiXfw4j2UQrLkypJNWOcqvakTjOXSZ89tYSX8iVOqNCQrVktskB413OG5kXc NbxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n18si7444494edt.3.2021.03.02.13.49.06; Tue, 02 Mar 2021 13:49:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382581AbhCBJkC (ORCPT + 99 others); Tue, 2 Mar 2021 04:40:02 -0500 Received: from vmi485042.contaboserver.net ([161.97.139.209]:38120 "EHLO gentwo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838099AbhCBJTS (ORCPT ); Tue, 2 Mar 2021 04:19:18 -0500 Received: by gentwo.de (Postfix, from userid 1001) id 576ABB00626; Tue, 2 Mar 2021 10:09:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by gentwo.de (Postfix) with ESMTP id 56A00B0061E; Tue, 2 Mar 2021 10:09:10 +0100 (CET) Date: Tue, 2 Mar 2021 10:09:10 +0100 (CET) From: Christoph Lameter To: Yejune Deng cc: penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] include/linux/slab.h: use for() and left shift to calculate In-Reply-To: <20210302033908.51706-1-yejune.deng@gmail.com> Message-ID: References: <20210302033908.51706-1-yejune.deng@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2 Mar 2021, Yejune Deng wrote: > use for() and left shift to calculate the value that compared with size. There is a reason for the madness... The current code was written so compilers can do proper constant folding and eliminate the whole function entirely. If you want this change then please verify that all compilers currently in use with this code do proper constant folding and never generate code for the for loop.