Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp687236rwi; Wed, 26 Oct 2022 06:08:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aBLIleP7hZod8tBkZ3DVEQXiy5sE/ctto+vbrlt6otqbQyOJ5sTiHe54AAWgTdhB7axiP X-Received: by 2002:a63:101:0:b0:460:6d90:3f81 with SMTP id 1-20020a630101000000b004606d903f81mr36015080pgb.545.1666789729508; Wed, 26 Oct 2022 06:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666789729; cv=none; d=google.com; s=arc-20160816; b=m/bDIP3MIGSm/C0o+bOaE/X+vKTPYlFJX2snB/6KtQ2zpDJL0Qh1t3MfUgmitBBdxB ZXFmU+0cj/hu6jnQSxt+nsdSh9zYAXrcMwi0nd+XYSpwZUXKUjyMqIAqJYJzoaRAdK6t 47LvHRFtEi8YyroPYM1L0IsXcODHUNluY9VwfWAU0BFsILZ3We2CbqCdQpsw0BBKWZdg bq45z1aTNaKzdRMabbYtOvOAMExwS6V0AyJQ6cLr26QB4QdjYpTKHhLOGqaE9qjmUNY4 5QsDeJXNACmWIKXRBNN/764dXrnxzNLEHurI+ZWtWFmsnSCqRMjwYY1svHTMQiP3cf1b Na3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=eIv913ZdAdUGkhzQn7afAMRtdSG1B+O9VtrUzUSO5sk=; b=L0vCGwTLvLZ+IGQR3vjN5BtE+4DiXPUKcZnIuhFawckuLk/lN8uDHW7UmSt8qA3ui2 f7iSL+9v+X2RPqLb3ktIB0g4VabTWXemE/Y8dPw9swXt8V1D/eaFZ6lLWwJeG7oYQpB8 s+HqXl7nu0hD+ttBrfeUjI2i1rk8tm/3XLhTvbwhGsIjnaGbvSXekwXAWkiJyCr02biZ 66H1qSsHGK8iMFUVHrvbAVpq7KE4uDjhHLFiFX46S/AAsw8jUhesWOG6LuXNc/iBAqku 6p0ZF8F8noxXkjy4B3EVcwOME4X9dBbas/BQnnxvt8/oKCVQqKX5IxQGGFr5owzyhmXm aQ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=drA0N835; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k16-20020a170902ce1000b0016f1c879eacsi6709032plg.109.2022.10.26.06.08.37; Wed, 26 Oct 2022 06:08:49 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=drA0N835; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbiJZNA0 (ORCPT + 99 others); Wed, 26 Oct 2022 09:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233993AbiJZNAR (ORCPT ); Wed, 26 Oct 2022 09:00:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A16B76B64D; Wed, 26 Oct 2022 06:00:12 -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 D18B461EC7; Wed, 26 Oct 2022 13:00:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40E44C43147; 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-f50.google.com with SMTP id d26so20901751eje.10; Wed, 26 Oct 2022 06:00:11 -0700 (PDT) X-Gm-Message-State: ACrzQf1ncGIEzBSiix+XzfRfn7oQ8pvT/OzffrTqnGBiLqi8isLh6AiQ I/NOEmMU3F5sfRwsBG4txixsXIKv+NDPJRmejKQ= 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 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org 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 >