From patchwork Mon Jul 4 11:25:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 12905109 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 E23C2C43334 for ; Mon, 4 Jul 2022 11:27:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 705B86B0072; Mon, 4 Jul 2022 07:27:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B4126B0073; Mon, 4 Jul 2022 07:27:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5A3146B0074; Mon, 4 Jul 2022 07:27:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4D7956B0072 for ; Mon, 4 Jul 2022 07:27:02 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 22B5C33DE2 for ; Mon, 4 Jul 2022 11:27:02 +0000 (UTC) X-FDA: 79649190684.21.C718F03 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf03.hostedemail.com (Postfix) with ESMTP id 47A3C20002 for ; Mon, 4 Jul 2022 11:27:01 +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 ams.source.kernel.org (Postfix) with ESMTPS id B7862B80EE7; Mon, 4 Jul 2022 11:26:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3FDCC341CE; Mon, 4 Jul 2022 11:26:53 +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 V4 4/4] LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP Date: Mon, 4 Jul 2022 19:25:26 +0800 Message-Id: <20220704112526.2492342-5-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220704112526.2492342-1-chenhuacai@loongson.cn> References: <20220704112526.2492342-1-chenhuacai@loongson.cn> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656934021; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mb+GeUE6nuf26bTBNl26axU3QA5sY2FXySauOQqepOk=; b=d1HVHnh33V3xMHeoTJJdr7vtUhtsUbF316YjSTI26UieH11O1j8xfUBcD4tHZKEq7SlKFO B6T+GIzRwUXbRTxLsAiZo1FtVioxThtXTfFAcLmU/pF9+O1MvG6P9yda+HEszuAw926PCG temsH8HT/DkjTSgBxRxLwABQGsuvfC8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of "SRS0=9gbD=XJ=loongson.cn=chenhuacai@kernel.org" designates 145.40.68.75 as permitted sender) smtp.mailfrom="SRS0=9gbD=XJ=loongson.cn=chenhuacai@kernel.org" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656934021; a=rsa-sha256; cv=none; b=G08tGaTpZ7008r0pbExM/BWmpR64MDnvcavwHMsunVRi3XWamAMwX8U3BJ/6nGUfAvc5ny bPFkc3VT9uV8cJXbGcnLigaQWqQ75qhoonbiC9QCB8khU2HHueKMWHJlAJoqsJhUs7lvx+ vEbgAPqO7pkvNQiKe1bdQ686i0zSk0I= Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf03.hostedemail.com: domain of "SRS0=9gbD=XJ=loongson.cn=chenhuacai@kernel.org" designates 145.40.68.75 as permitted sender) smtp.mailfrom="SRS0=9gbD=XJ=loongson.cn=chenhuacai@kernel.org" X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 47A3C20002 X-Stat-Signature: pzqoe6rk5x14gxf3n9i8jjcfrqa1hopc X-Rspam-User: X-HE-Tag: 1656934021-438486 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: 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