Received: by 2002:ac0:cd04:0:0:0:0:0 with SMTP id w4csp582020imn; Sat, 2 Jul 2022 01:03:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uXKkFSl11PMBGqavLiKNyqxx3q2QekqHscYGvhkBnjJKf4vvMNW14x1jI5ggDZPcuXM6OU X-Received: by 2002:aa7:cccb:0:b0:437:77d3:4d5c with SMTP id y11-20020aa7cccb000000b0043777d34d5cmr23701113edt.230.1656749004278; Sat, 02 Jul 2022 01:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656749004; cv=none; d=google.com; s=arc-20160816; b=ffh2B8H+MkbmgVaCo0+CvvOdTvnt4vG7PrhuPfoOyVqcn1PRWwPtYZjsVOGE9WKt1r o7s+BN2TnWG1eKq8LIZcKMrsNSHGXbl+Sove/tsEqycKTHICPMXPaoWcCnhDYDKv+Bky HpAQaMAwDAfM7yf1HjMsTkCWpEfb/CTZhOrAuZQbP/ByXqTYiVD7tnS0XItdTAL4PI7e IyupJuNjhTKzepi+Ynhv2+vZH0rzKNa/mewoELwghNyLY08czROLN6ajLPCAd0AUDnK3 6l3hilYljo8LKBNiV2vlxuaeVnp46wIyuLzTJWrBmM5Z556y9YVf6Z+x5SBe215MXhgK VazA== 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=mb+GeUE6nuf26bTBNl26axU3QA5sY2FXySauOQqepOk=; b=K6BEZHUQHleyIRCdVbjJSZTEk9LveMnvIQjNNOUqOP4bKWDTH3jrOUB3TUah2cbr8m TfX4kkTwisNMCq2BuWII2LSNAaB5UV1jD9VZ4Ua5O2siAWbll3QsHr6XqOV86NWLjaIO NeQldmKo/aPNP5uJ5UiIQ3oHKFXTdSEysz7HAvasztkSdow/mEiJN61b7eow4xs2BzO2 bwwav9B9XkfbpOPktoh5M4Q0Tdc3VqEmmVm9Nm+ouglr1ETsV6gEDZsyaIQe8VA1kpT/ +7CPMfp4dfBePQaHjSP7FUeUCsLxy+X3VgRpJFpnSpUd0M7CqNKTcGWqPoqm0uEkeVFE JI6g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a05640242c200b004359150cd1fsi3293854edc.128.2022.07.02.01.02.59; Sat, 02 Jul 2022 01:03:24 -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 S232151AbiGBIBo (ORCPT + 99 others); Sat, 2 Jul 2022 04:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiGBIBm (ORCPT ); Sat, 2 Jul 2022 04:01:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A1123145; Sat, 2 Jul 2022 01:01:40 -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 ams.source.kernel.org (Postfix) with ESMTPS id 914E8B83267; Sat, 2 Jul 2022 08:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B828FC341C8; Sat, 2 Jul 2022 08:01:33 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Huacai Chen , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon Cc: loongarch@lists.linux.dev, linux-arch@vger.kernel.org, Xuefeng Li , Guo Ren , 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 , Huacai Chen Subject: [PATCH V3 4/4] LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP Date: Sat, 2 Jul 2022 16:00:21 +0800 Message-Id: <20220702080021.1167190-5-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220702080021.1167190-1-chenhuacai@loongson.cn> References: <20220702080021.1167190-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, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 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 55ab84fd70e5..8e56ca28165e 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -49,6 +49,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_WANTS_NO_INSTR select BUILDTIME_TABLE_SORT select COMMON_CLK diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e66f7aa3191d..28a53ac7aa3e 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -9,6 +9,7 @@ #include #include #include +#include #ifndef __GENERATING_BOUNDS_H #include #include -- 2.27.0