From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7EAFECAAD2 for ; Mon, 29 Aug 2022 14:21:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3EEEC940008; Mon, 29 Aug 2022 10:21:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 39E79940007; Mon, 29 Aug 2022 10:21:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 265D3940008; Mon, 29 Aug 2022 10:21:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 175E4940007 for ; Mon, 29 Aug 2022 10:21:10 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E5D8F80267 for ; Mon, 29 Aug 2022 14:21:09 +0000 (UTC) X-FDA: 79852842258.04.2EB261B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf02.hostedemail.com (Postfix) with ESMTP id 6764280055 for ; Mon, 29 Aug 2022 14:21:09 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D5FEF220F0; Mon, 29 Aug 2022 14:21:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661782867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lqxMa1HBJ0+cGOogi0JdL8WYldDRadh4OFmol9texAQ=; b=VG+DHFcicKks5ebQV7XOTDPUERxlHNDH0SVdiTkGLHb+fFIAAWV0Zv1oRAC2qTA1T+Q7UA hJ/tYEFzaNaRf3nLXomDYyM42RuEX3Pzcwky7dVwZyz8EhaUyvc9lk1/0AUO3l0hb0AMq6 jyIqtcUKM222nKn+tsmgsalshI9CndA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661782867; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lqxMa1HBJ0+cGOogi0JdL8WYldDRadh4OFmol9texAQ=; b=u57++SwFNz0+yP3FfdqhJSANUV5+nwH03ePx6bkJLBGUaVbALZo1pN0ba1ceOiwtvs/W0u W3MHLyIlGwIeG2BQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A2502133A6; Mon, 29 Aug 2022 14:21:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 46ddJlPLDGNCaQAAMHmgww (envelope-from ); Mon, 29 Aug 2022 14:21:07 +0000 Message-ID: <1188aeeb-3949-b561-bec0-512ed763d857@suse.cz> Date: Mon, 29 Aug 2022 16:21:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] mm: simplify size2index conversion of __kmalloc_index Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Matthew Wilcox Cc: Dawei Li , cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661782869; a=rsa-sha256; cv=none; b=VkrCU9uLohQZWxDEkTAiYshWiyncVyHj34OCgOwQqOuusXPIXakTEDHtxDX6GUVB9KQ0Za QlTCay40oYWqdGThvZrBVBDEPrLnaNz/e+zotOJDBA1619kda5JTxlbR/ZEWwHKEPWtU2J eXRR7Der92iqrJtE63CPj1EU9Pm+V3w= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=VG+DHFci; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=u57++SwF; dmarc=none; spf=pass (imf02.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661782869; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lqxMa1HBJ0+cGOogi0JdL8WYldDRadh4OFmol9texAQ=; b=SUrXiDH8wiIUweYu2Rn+o0SvFo1vGSsvbBKbuIAjKrOoam1k9oGNJevjiTABwDer/UG6k3 07QHRMNo9d8k+vXen9GJAyqLuEMa5/udOvDX14aviAEKX4o7qoEcGkboTOK2BA22OjaWkP IwX7WS57xVRkOtNW7Vy/XUjQIwhoJnM= X-Rspam-User: X-Rspamd-Queue-Id: 6764280055 X-Rspamd-Server: rspam12 X-Stat-Signature: oicub6whuphocn1gj3qx4nmmipn6ftko Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=VG+DHFci; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=u57++SwF; dmarc=none; spf=pass (imf02.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-HE-Tag: 1661782869-43645 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 8/29/22 05:36, Hyeonggon Yoo wrote: > 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? Is there a way to turn inability of compile-time calculation to a compile-time error? (when size_is_constant=true etc). Then we could try and see if anything breaks in -next.