Message ID | 20221020072317.492906-5-chenhuacai@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp117123wrs; Thu, 20 Oct 2022 00:39:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM623KMapfpoFOyWHEf6EnubUSY5tRh0bMqm+7m0i9vLw6VFyKbKq5PKaxmpN+AiglMYa2Aa X-Received: by 2002:a63:1b5d:0:b0:461:7362:e8b5 with SMTP id b29-20020a631b5d000000b004617362e8b5mr10585919pgm.83.1666251577168; Thu, 20 Oct 2022 00:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666251577; cv=none; d=google.com; s=arc-20160816; b=SLmOh0EjkOa/Ds3jI9i2UQUAkFcP9ZHvd+CF5+3JUYAXXwFBxaHqxhtceNdee89SGl FIoKhjqt+X/gqhGEhvdG6Dsmb60kn3tF8QG02IZ6cIuEE5bUT6fBVe7Kdn8T/8rj7ENT 3EkIUKodKlKrynSrbQAR6VE8I0U6eto0aWnaEMYAQoPAwO/k/vTs82UYJW3vA++2XnRb 8saCvpdjh/GdC1q+/db3L1bgzcJ1HTRgGnrJ1ER9kEM/PuI8vEw7/eyVzoERG/quRgUI 5owhGsIewX99rhoVXBRPIcH1e70Id/GGM7dQblecqulUw6pgVo+2cSNxok9LcQqwGbyt tnMw== 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=TD8pIuAf+snupXBZzfyzhVzBIuWecDRG4k7m7plx5HE=; b=h2fSN/x0tOf8+gv2cwPSfAaTTaf8P+sQtoYZjlLBeKZy9nI6LyAoBn7X4d8mvbjsKe KYqEUx1zIwB0GtAyxYysa08Fny4tKMd+8/09ZysHl6hJiNXkxkx8eQ91IQObC2gaZ/qM 5QGREGoatxDQwbmqfq2Yd//gcPseTcFeeGSaX21AXf6rFdX7NB6LJhzp35yUSGihUdBi mylNvFdOxvmxuFOIuo1YsAd7T9k88mLhVCjG1ibQHOLoB8uLF+7ewNXDNuTTwNd2cH+9 lCqO32AKxj7o/tPZrN2eo4FCZgPFXa3DdmslL8qs4dvRgFVzNLUY+8yMRABCWArptnre x12g== 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 x7-20020a628607000000b0052dccbf4079si19001381pfd.220.2022.10.20.00.39.24; Thu, 20 Oct 2022 00:39:37 -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 S229968AbiJTH2Q (ORCPT <rfc822;realc9580@gmail.com> + 99 others); Thu, 20 Oct 2022 03:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230121AbiJTH2M (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 20 Oct 2022 03:28:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F443164BE3; Thu, 20 Oct 2022 00:28:09 -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 B502361A1B; Thu, 20 Oct 2022 07:28:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF1ABC433D7; Thu, 20 Oct 2022 07:28:02 +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>, Huacai Chen <chenhuacai@loongson.cn> Subject: [PATCH V12 4/4] LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP Date: Thu, 20 Oct 2022 15:23:17 +0800 Message-Id: <20221020072317.492906-5-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221020072317.492906-1-chenhuacai@loongson.cn> References: <20221020072317.492906-1-chenhuacai@loongson.cn> MIME-Version: 1.0 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?1747191413721662008?= X-GMAIL-MSGID: =?utf-8?q?1747191413721662008?= |
Series |
mm/sparse-vmemmap: Generalise helpers and enable for LoongArch
|
|
Commit Message
Huacai Chen
Oct. 20, 2022, 7:23 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. 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 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 20/10/22 09:23, Huacai Chen 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/ s/should/have to/ > static_key.h in page-flags.h. This looks like 2 different changes in a single patch.. The first is a generic "fix missing include" and the second is LoongArch specific. Splitting in 2 would ease backport cherry-picks. > 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 > > 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> > #ifndef __GENERATING_BOUNDS_H > #include <linux/mm_types.h> > #include <generated/bounds.h> Preferably splitting in 2 distinct patches (for each): Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Hi, Philippe, On Fri, Oct 21, 2022 at 6:16 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > On 20/10/22 09:23, Huacai Chen 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/ > > s/should/have to/ Thanks, I will change it. > > > static_key.h in page-flags.h. > > This looks like 2 different changes in a single patch.. The first is a > generic "fix missing include" and the second is LoongArch specific. The static_key.h inclusion is also LoongArch-specific, implicitly. X86 and ARM64 have no build errors without this inclusion, because they include static_key.h from their arch-specific core headers. Once before I have sent a separate patch to "fix missing include", but Greg said that "don't fix unless you have a real problem". :) Huacai > > Splitting in 2 would ease backport cherry-picks. > > > 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 > > > > 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> > > #ifndef __GENERATING_BOUNDS_H > > #include <linux/mm_types.h> > > #include <generated/bounds.h> > > Preferably splitting in 2 distinct patches (for each): > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > >
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>