Message ID | 20221024070105.306280-5-chenhuacai@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp294931wru; Mon, 24 Oct 2022 00:08:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7n0VXf7HNQ0vrRJeVy9Hhb7WpEKlrLbpNCOpiKiddI7FAv/1bSLYR+BuZmlm8s/UYeJ2CI X-Received: by 2002:a63:1e21:0:b0:43a:b17f:cd13 with SMTP id e33-20020a631e21000000b0043ab17fcd13mr27147991pge.553.1666595289831; Mon, 24 Oct 2022 00:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666595289; cv=none; d=google.com; s=arc-20160816; b=ciEbdmhOoVIY0tHLQn9tDTWI+YJF9nLMsXx4FWqVcumHhcFk7G5gK+Fno7ElHhaJNd fM0cCkvw/I4RdhzqepYMLHURErwR6qxHb+ppqSO56eU7IDsq+ddwqRb4ktJflXblUxjd ZJZcy5/6m9CjsRpHvSCnGKj7VXESpUbQxLxwEImY+je1L7tiIibaNH4NLdgIbqWIuuri dOiiNOILQdwBkeYEpyW+RtkP2doTXMm9Z6TC+GmS/zaFKSj49zgPpn6USNQHzKKtEK4t mifRyx67fkLRPsvlcUcqm30D+CKxU9wAqg/mEXIOIPdZiqJgZ4/fnwF6bIFqgrGuol89 nBdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=VfHo1Ypus8fR0frSUi11W5LSxiM6+OpdesxiFS74+mc=; b=mOpOd6HWkEG9Y2nPqyJgLzHwAvRmndd6aDDar4OgHMxKMy60QCcGV0JN0Udepm30in LfP6k0mAMcv2dLYI04MCR/F7B4eDQDKKD4ULSpLk2kvHJAz4uIl1IrUkxeClsE7zR6DL L/BzCKkv8Y2pVwIVM2FjOh4dGMoJWGILd7VKE8lyFU/XOORm9tBfafrGaiuTkxNQpNak WFg5Pv5DzyuvWoncUWJHDeYFPZjMLI2MldlzprlxliP3ef6nj3XU4KPL/DZaybzByyBK Gxb3rUeJrfkRi/tw2MVuIxp/5+19hWOegkOheTXg8z8a/amby/1y0uMH5Bc05z7VI9Nt 082Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a631145000000b004428327e6dfsi35115117pgr.174.2022.10.24.00.07.57; Mon, 24 Oct 2022 00:08:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230320AbiJXHFs (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Mon, 24 Oct 2022 03:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230324AbiJXHFk (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 24 Oct 2022 03:05:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D76F481C0; Mon, 24 Oct 2022 00:05:35 -0700 (PDT) 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 61AB961018; Mon, 24 Oct 2022 07:05:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74943C433D6; Mon, 24 Oct 2022 07:05:28 +0000 (UTC) From: Huacai Chen <chenhuacai@loongson.cn> To: Arnd Bergmann <arnd@arndb.de>, Huacai Chen <chenhuacai@kernel.org>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Dave Hansen <dave.hansen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Dinh Nguyen <dinguyen@kernel.org> Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li <lixuefeng@loongson.cn>, Guo Ren <guoren@kernel.org>, Xuerui Wang <kernel@xen0n.name>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Feiyang Chen <chenfeiyang@loongson.cn>, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, Huacai Chen <chenhuacai@loongson.cn> Subject: [PATCH V13 4/4] LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP Date: Mon, 24 Oct 2022 15:01:05 +0800 Message-Id: <20221024070105.306280-5-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221024070105.306280-1-chenhuacai@loongson.cn> References: <20221024070105.306280-1-chenhuacai@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747551822500327323?= X-GMAIL-MSGID: =?utf-8?q?1747551822500327323?= |
Series |
mm/sparse-vmemmap: Generalise helpers and enable for LoongArch
|
|
Commit Message
Huacai Chen
Oct. 24, 2022, 7:01 a.m. UTC
From: Feiyang Chen <chenfeiyang@loongson.cn> 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_DEFAULT_ON, | ^~~~~~~~~~~~~~~~~~~~~~~~ ./include/linux/page-flags.h:208:1: error: type defaults to 'int' in declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=implicit-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_enabled': ./include/linux/page-flags.h:213:16: error: implicit declaration of function 'static_branch_maybe' [-Werror=implicit-function-declaration] 213 | return static_branch_maybe(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_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_DEFAULT_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é <philmd@linaro.org> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> --- arch/loongarch/Kconfig | 1 + include/linux/page-flags.h | 1 + 2 files changed, 2 insertions(+)
Comments
On Mon, Oct 24, 2022 at 3:05 PM Huacai Chen <chenhuacai@loongson.cn> wrote: > > From: Feiyang Chen <chenfeiyang@loongson.cn> > > 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_DEFAULT_ON, > | ^~~~~~~~~~~~~~~~~~~~~~~~ > ./include/linux/page-flags.h:208:1: error: type defaults to 'int' in > declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=implicit-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_enabled': > ./include/linux/page-flags.h:213:16: error: implicit declaration of > function 'static_branch_maybe' [-Werror=implicit-function-declaration] > 213 | return static_branch_maybe(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_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_DEFAULT_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é <philmd@linaro.org> > Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > --- > 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 <linux/types.h> > #include <linux/bug.h> > #include <linux/mmdebug.h> > +#include <linux/static_key.h> Em... riscv needn't this. > #ifndef __GENERATING_BOUNDS_H > #include <linux/mm_types.h> > #include <generated/bounds.h> > -- > 2.31.1 >
Hi, Ren, On Mon, Oct 24, 2022 at 4:04 PM Guo Ren <guoren@kernel.org> wrote: > > On Mon, Oct 24, 2022 at 3:05 PM Huacai Chen <chenhuacai@loongson.cn> wrote: > > > > From: Feiyang Chen <chenfeiyang@loongson.cn> > > > > 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_DEFAULT_ON, > > | ^~~~~~~~~~~~~~~~~~~~~~~~ > > ./include/linux/page-flags.h:208:1: error: type defaults to 'int' in > > declaration of 'DECLARE_STATIC_KEY_MAYBE' [-Werror=implicit-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_enabled': > > ./include/linux/page-flags.h:213:16: error: implicit declaration of > > function 'static_branch_maybe' [-Werror=implicit-function-declaration] > > 213 | return static_branch_maybe(CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_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_DEFAULT_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é <philmd@linaro.org> > > Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn> > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > > --- > > 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 <linux/types.h> > > #include <linux/bug.h> > > #include <linux/mmdebug.h> > > +#include <linux/static_key.h> > 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 <linux/mm_types.h> > > #include <generated/bounds.h> > > -- > > 2.31.1 > > > > > -- > Best Regards > Guo Ren >
On 26/10/22 14:59, Huacai Chen wrote: > On Mon, Oct 24, 2022 at 4:04 PM Guo Ren <guoren@kernel.org> wrote: >> On Mon, Oct 24, 2022 at 3:05 PM Huacai Chen <chenhuacai@loongson.cn> wrote: >>> >>> From: Feiyang Chen <chenfeiyang@loongson.cn> >>> >>> 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. >>> 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 <linux/types.h> >>> #include <linux/bug.h> >>> #include <linux/mmdebug.h> >>> +#include <linux/static_key.h> >> Em... riscv needn't this. Would guarding the header suffice and make riscv OK with this patch? #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP #include <linux/static_key.h> #endif > 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
On Wed, Oct 26, 2022 at 9:44 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > On 26/10/22 14:59, Huacai Chen wrote: > > On Mon, Oct 24, 2022 at 4:04 PM Guo Ren <guoren@kernel.org> wrote: > >> On Mon, Oct 24, 2022 at 3:05 PM Huacai Chen <chenhuacai@loongson.cn> wrote: > >>> > >>> From: Feiyang Chen <chenfeiyang@loongson.cn> > >>> > >>> 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. > > >>> 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 <linux/types.h> > >>> #include <linux/bug.h> > >>> #include <linux/mmdebug.h> > >>> +#include <linux/static_key.h> > >> Em... riscv needn't this. > > Would guarding the header suffice and make riscv OK with this patch? Emm, since LoongArch has no build errors due to an accident now, I will send a new version without static_key.h inclusion. If one day the build error comes back, we can send a separate patch to fix it. Huacai > > #ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP > #include <linux/static_key.h> > #endif > > > 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
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 <linux/types.h> #include <linux/bug.h> #include <linux/mmdebug.h> +#include <linux/static_key.h> #ifndef __GENERATING_BOUNDS_H #include <linux/mm_types.h> #include <generated/bounds.h>