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 0FE79C433FE for ; Wed, 26 Oct 2022 13:00:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8CC5E8E0002; Wed, 26 Oct 2022 09:00:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87CAD8E0001; Wed, 26 Oct 2022 09:00:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 744678E0002; Wed, 26 Oct 2022 09:00:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 633ED8E0001 for ; Wed, 26 Oct 2022 09:00:14 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 251F9A07FB for ; Wed, 26 Oct 2022 13:00:14 +0000 (UTC) X-FDA: 80063108748.13.15B934E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id C408740028 for ; Wed, 26 Oct 2022 13:00:12 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C1CE761ECA for ; Wed, 26 Oct 2022 13:00:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3279FC433D6 for ; Wed, 26 Oct 2022 13:00:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666789211; bh=RuIUY+rX8vQ87Hr5u8x9gIRK+2Qcc/QJ2fIL10pKenw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=drA0N835VJsELpOcnuwVqQJhcjL7Ile9eiojJT1XoCgMVFRyTJ0HbOfY1o4kTjkje 2eSfk9DnWuskgMWrPumWxTfxy1waGb5Afe2p18BxAhZY/jCYEceVIuo2KjiWP/L27L cdgwUtscgCf41ggwglOp3A/enE3pcUDf+mz0AIZWDLvxTv761+HcgpoJQtwCiCUdcP 0Z+8KuyVQ3DRbK2OxorgbavxwknDifDIWIOf/Jy8cdOEAdVckEWOMfldiVhzPfQEnU UpUbg3MMEpUY29QETfv9IoBSHx0InWn2m1pj9eTZ9+um09B7jPOmKtOjhTJ1r+HfOZ uWDQL4k3Kt/RQ== Received: by mail-ej1-f43.google.com with SMTP id 13so21034377ejn.3 for ; Wed, 26 Oct 2022 06:00:11 -0700 (PDT) X-Gm-Message-State: ACrzQf3F5IYbZS74jRoZSzCBJiNm4eSpHXV8/A7f/yinGaDbAGicAuYX yPJo0G0m7enlxxvr1jxJt+zJl4ETg/IuaM433Yg= X-Google-Smtp-Source: AMsMyM4BhqSlTpO8ibTrKQeHLQ4fCvgCJZu7h/bMiC5C1Sao3Cq8lb8MWz6w3OPaxPefOI2UKkBz797pHxL+UBvb+9M= X-Received: by 2002:a17:906:9753:b0:791:9f71:a8e6 with SMTP id o19-20020a170906975300b007919f71a8e6mr36598179ejy.272.1666789209448; Wed, 26 Oct 2022 06:00:09 -0700 (PDT) MIME-Version: 1.0 References: <20221024070105.306280-1-chenhuacai@loongson.cn> <20221024070105.306280-5-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Wed, 26 Oct 2022 20:59:57 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V13 4/4] LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP To: Guo Ren Cc: Huacai Chen , Arnd Bergmann , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon , Dinh Nguyen , loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Xuerui Wang , Jiaxun Yang , Andrew Morton , linux-mm@kvack.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Feiyang Chen , =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666789212; 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=eIv913ZdAdUGkhzQn7afAMRtdSG1B+O9VtrUzUSO5sk=; b=TiBT92cSRaVTMK2aevxrlja99SyiIm7uYoDOgQuN1iib+7vPSZZ90IZI/z/u4GEk4GnT6z wh1ZCnRnqUKFaEvTEHnjjpQRU59GZlHXRK0+DEkClW7QR5J8xl4HsC73P37iwmBDM5doK3 X0YL86Il2LKD+drQsp3H54sBIPd6gm8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=drA0N835; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of chenhuacai@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chenhuacai@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666789212; a=rsa-sha256; cv=none; b=ZgWylQfzGy5Pw53Uu7VPP2O/SouUmtOpuENfVrFaQaY06P8XF48TdgWU666iWkQ+b8X6fA AOj2iESgWXky1GTCeFWR4LZQYNFLnhHo/eOdAe2yfInJlpaCl+wurvw7N3IxaDDafv2GZ3 YBWVpBZoJOmn+DPMYqwERcJPiOLv2FU= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C408740028 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=drA0N835; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of chenhuacai@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chenhuacai@kernel.org X-Stat-Signature: erh5yjq7ctzj1t981gzq85gaqygzegyt X-HE-Tag: 1666789212-655247 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: Hi, Ren, On Mon, Oct 24, 2022 at 4:04 PM Guo Ren wrote: > > On Mon, Oct 24, 2022 at 3:05 PM Huacai Chen wrot= e: > > > > From: Feiyang Chen > > > > The feature of minimizing overhead of struct page associated with each > > HugeTLB page is implemented on x86_64. However, the infrastructure of > > this feature is already there, so just select ARCH_WANT_HUGETLB_PAGE_ > > OPTIMIZE_VMEMMAP is enough to enable this feature for LoongArch. > > > > To avoid the following build error on LoongArch we should include linux= / > > static_key.h in page-flags.h. This is straightforward but the build > > error is implicitly a LoongArch-specific problem, because ARM64 and X86 > > have already include static_key.h from their arch-specific core headers= . > > > > In file included from ./include/linux/mmzone.h:22, > > from ./include/linux/gfp.h:6, > > from ./include/linux/mm.h:7, > > from arch/loongarch/kernel/asm-offsets.c:9: > > ./include/linux/page-flags.h:208:1: warning: data definition has no > > type or storage class > > 208 | DECLARE_STATIC_KEY_MAYBE(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEF= AULT_ON, > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/page-flags.h:208:1: error: type defaults to 'int' in > > declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=3Dimplicit-int] > > ./include/linux/page-flags.h:209:26: warning: parameter names (without > > types) in function declaration > > 209 | hugetlb_optimize_vmemmap_key); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/page-flags.h: In function 'hugetlb_optimize_vmemmap_ena= bled': > > ./include/linux/page-flags.h:213:16: error: implicit declaration of > > function 'static_branch_maybe' [-Werror=3Dimplicit-function-declaration= ] > > 213 | return static_branch_maybe(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_D= EFAULT_ON, > > | ^~~~~~~~~~~~~~~~~~~ > > ./include/linux/page-flags.h:213:36: error: > > 'CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON' undeclared (first > > use in this function); did you mean > > 'CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP'? > > 213 | return static_branch_maybe(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_D= EFAULT_ON, > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > | CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP > > ./include/linux/page-flags.h:213:36: note: each undeclared identifier > > is reported only once for each function it appears in > > ./include/linux/page-flags.h:214:37: error: > > 'hugetlb_optimize_vmemmap_key' undeclared (first use in this > > function); did you mean 'hugetlb_optimize_vmemmap_enabled'? > > 214 | &hugetlb_optimize_vmemmap_key); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > | hugetlb_optimize_vmemmap_enabled > > > > Reviewed-by: Philippe Mathieu-Daud=C3=A9 > > Signed-off-by: Feiyang Chen > > Signed-off-by: Huacai Chen > > --- > > arch/loongarch/Kconfig | 1 + > > include/linux/page-flags.h | 1 + > > 2 files changed, 2 insertions(+) > > > > diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig > > index 6f7fa0c0ca08..0a6ef613124c 100644 > > --- a/arch/loongarch/Kconfig > > +++ b/arch/loongarch/Kconfig > > @@ -52,6 +52,7 @@ config LOONGARCH > > select ARCH_USE_QUEUED_RWLOCKS > > select ARCH_USE_QUEUED_SPINLOCKS > > select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT > > + select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP > > select ARCH_WANT_LD_ORPHAN_WARN > > select ARCH_WANTS_NO_INSTR > > select BUILDTIME_TABLE_SORT > > diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > > index 0b0ae5084e60..1aafdc73e399 100644 > > --- a/include/linux/page-flags.h > > +++ b/include/linux/page-flags.h > > @@ -9,6 +9,7 @@ > > #include > > #include > > #include > > +#include > Em... riscv needn't this. I found that after 36d4b36b69590fed99356a4426c940a25 (" lib/nodemask: inline next_node_in() and node_random()"), build errors have gone. But I think this is just an accident. Because that commit adds random.h inclusion in nodemask.h, then asm-offsets.c --> sched.h --> nodemask.h --> random.h --> once.h --> jump_label.h. If one day this chain is adjusted, then build errors come again. On the other hand, page-flags.h is obviously using some static_key macros, including static_key.h is straightforward for building. Huacai Huacai > > > #ifndef __GENERATING_BOUNDS_H > > #include > > #include > > -- > > 2.31.1 > > > > > -- > Best Regards > Guo Ren >