Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2763677rwe; Sun, 28 Aug 2022 22:26:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MS1EmxT+Nwy1xtd/G6rNoX32U891DZUpJSNydQniQykIvkimLaBITtY/xjtG+G6eHaaUJ X-Received: by 2002:a17:902:7c03:b0:172:56b1:8152 with SMTP id x3-20020a1709027c0300b0017256b18152mr14967111pll.16.1661750760016; Sun, 28 Aug 2022 22:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661750760; cv=none; d=google.com; s=arc-20160816; b=sdTv8ZyCk28wD9v0i+nCOQhFh/wVidjHhwgAsOO9RvuGAkMCwbvXEk3A1RwNk9c75W tLgp/jyK0JF6tlbY+xIqQTwp49Q5VTrOrmNnnLL75m9+e6eOQU8RubkZcs7aAuOSlaaf VYH0rtmF31j2RHe+UJK39QyRtNI7GQUVsCY89JO018w7Y3CMfWb5J9u2aDDB2tMshNsv 8GBaosbx1Q5KiIC1L9ObzU3EZCyXneTEu13og8wzxIkYfQE3DmrT+KIWUyodHyuYzjt6 3NuhaUmwxMP87C75dSpEOn77egvehrcBxJNNt8gh9BhfztTXvMwnYncnyerAI7AqBBZ7 GDtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ljjtZByavJYwGMqEDoi1bPqP2XeQlrKsYOp8SuafT3s=; b=nZZaiWSvzIuJD+K8JjBPrrgpIqRQ8Ji2KWgYuEo4dMEbI0T4gLqSIBJkF4POzK05pZ Fr/J8GGp6/JJRaNcq+txkafgdRruTzOz46+u1Mfyu89mqfm4FaRMEp17JBiB6Q/g6SPI FQEHz1lqKywn6fzRa8QxnhSZpHzRmMOF6bMdK9KUTWRVn8ISwchUN7GNj+3f7bsxn/Tc mYWmFlCNzyvAGP1iwP8am0vNwLNmWKHRI26WN6/i2570E+O13xr/p+eYPF82eiSyNQ9p ecGo2D8MvjPLZbJsLu47PpISJPg5cZSGG8YBHtRlTLdI0pFrxGnbnM5S0lR3BFq9iou8 dJLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="HtamZU/K"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a056a00174e00b00527d4769260si8774384pfc.332.2022.08.28.22.25.46; Sun, 28 Aug 2022 22:26:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="HtamZU/K"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229751AbiH2Dgb (ORCPT + 99 others); Sun, 28 Aug 2022 23:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiH2Dg3 (ORCPT ); Sun, 28 Aug 2022 23:36:29 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B4A2409E for ; Sun, 28 Aug 2022 20:36:28 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id x80so2991701pgx.0 for ; Sun, 28 Aug 2022 20:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=ljjtZByavJYwGMqEDoi1bPqP2XeQlrKsYOp8SuafT3s=; b=HtamZU/KSkrTmyaRvuvKRC9UPAqGxWwQyyA17LXAfvk3VVa6gKoDrunBsmYLksOlR7 mQzDr/6bOU7BKzc1aBvld38Dh9A1IR35flF+OjnlAOBN+kdvUsuw4J5WYXDBCDfj4s9U HcSmp8t/oJnsAOKkdAn6bVmpyBjp6fi4wcpIMxtt6cphFjTxhPCGjqU/7wbrX5Gu/y3X KvRUy/n67qLSXIcmILfPGwum+Rkb27eweGUmpOOlHNwKIRWojSdiIh70YLCvDk3FTf/s gI41JutfQdauEo8Z/I6DOf7jZlKttiq75Ku2Gqw52fs7fzoww98h6T/HKVX1bcK39BQy iKzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=ljjtZByavJYwGMqEDoi1bPqP2XeQlrKsYOp8SuafT3s=; b=mXBx+srBydGdBc+dS36xVaEhXvmPiFQITFGi/UxSdOrDnG0YW9Cqy80nOfyg13+DR1 lBtvYWI3EIXzftQrfohjJC7RuVhmL+RqG9QsxSc4ecfkzw+JlvkIRWjDdWOuRWVzpT9+ H0Z6sSl9B5nA/1ZLORW5TKQcyt1ioZdnhoec+nzHzAMDGM3LaPwaxBjOllvuds00TZii T4JIMYTNF0/OtTPw6f2/2q09U9PWnL1fI7nr5+fxipuFbsS5lrRvbq2+f7EGgUrg2epd mjhg5KjMz9n/RkGP+SP1maVe3mesThp7Ib8TjAjDeZtjRgbHFqnyI+gm0YvM9BMBX9YL GkvA== X-Gm-Message-State: ACgBeo3bZXUU6LWlcwpS6QOTZMkEsajqA20pZ4djY0OR5i9XjHaKD2wb DfQzJp8sbcn3N9MFycD6zh8= X-Received: by 2002:aa7:88c8:0:b0:536:926:700f with SMTP id k8-20020aa788c8000000b005360926700fmr14999577pff.72.1661744188074; Sun, 28 Aug 2022 20:36:28 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id h193-20020a6283ca000000b0052e6d5ee183sm5972077pfe.129.2022.08.28.20.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 20:36:27 -0700 (PDT) Date: Mon, 29 Aug 2022 12:36:21 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Matthew Wilcox Cc: Dawei Li , cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, vbabka@suse.cz, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: simplify size2index conversion of __kmalloc_index Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URI_DOTEDU autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 29, 2022 at 04:11:04AM +0100, Matthew Wilcox wrote: > On Sun, Aug 28, 2022 at 11:14:48PM +0800, Dawei Li wrote: > > Current size2index is implemented by one to one hardcode mapping, > > which can be improved by order_base_2(). > > Must be careful to not violate compile-time optimization rule. > > This patch has been NACKed before (when submitted by other people). Hmm right. https://lkml.iu.edu/hypermail/linux/kernel/1606.2/05402.html Christoph Lameter wrote: > On Wed, 22 Jun 2016, Yury Norov wrote: > > There will be no fls() for constant at runtime because ilog2() calculates > > constant values at compile-time as well. From this point of view, > > this patch removes code duplication, as we already have compile-time > > log() calculation in kernel, and should re-use it whenever possible.\ > The reason not to use ilog there was that the constant folding did not > work correctly with one or the other architectures/compilers. If you want > to do this then please verify that all arches reliably do produce a > constant there. Can we re-evaluate this? -- Thanks, Hyeonggon