From patchwork Thu Jun 30 04:32:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 12901030 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 B5F04C43334 for ; Thu, 30 Jun 2022 04:31:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEC866B0072; Thu, 30 Jun 2022 00:31:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C751D6B0073; Thu, 30 Jun 2022 00:31:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B15C48E0001; Thu, 30 Jun 2022 00:31:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9D8656B0072 for ; Thu, 30 Jun 2022 00:31:39 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 75F4D12067C for ; Thu, 30 Jun 2022 04:31:39 +0000 (UTC) X-FDA: 79633628718.21.234C361 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf20.hostedemail.com (Postfix) with ESMTP id BC2741C003E for ; Thu, 30 Jun 2022 04:31:38 +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 F2DC2B82889; Thu, 30 Jun 2022 04:31:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2FEFC34115; Thu, 30 Jun 2022 04:31:30 +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, Huacai Chen , Feiyang Chen Subject: [PATCH V2 0/4] mm/sparse-vmemmap: Generalise helpers and enable for Date: Thu, 30 Jun 2022 12:32:33 +0800 Message-Id: <20220630043237.2059576-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656563499; a=rsa-sha256; cv=none; b=Z60YlxSwDpxk/G8PwjUzFx62c8TX5Br7VFvK4NrxHag1Gk5yuImTHXCSKoz8s5cy3KHAGH DBoOU9j+AuqrIAjw+62MkiybUd70gvog+9wEG2IJUMSlhRL7/pGS/h14RB/fYVejhNSDJT 5HPSOXXXrkWBRf4ATUiLQe9iMcIGO04= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of "SRS0=Dk8Y=XF=loongson.cn=chenhuacai@kernel.org" designates 145.40.68.75 as permitted sender) smtp.mailfrom="SRS0=Dk8Y=XF=loongson.cn=chenhuacai@kernel.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656563499; 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:references; bh=+ydUyVFi6/8Bhs9/8RzUY5k7ozmCDK1a7CkjIzm+Bn4=; b=rsHr9Hp1ZAEH3EaGTAzGAOwWR9BGL2pwazRR/bA0HXwDK7vyjOKN6OQEZdkxBqPd9rog+i bn/Bkv6uSZPinI3V4tqSVueK2/NhZxW219l/PbO3w/DPySP3k5taBtQ55Poga3XfwFOEyK VGxku4sTqlyPrBx5Llz0JMhBN7bSQc0= X-Rspamd-Queue-Id: BC2741C003E X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of "SRS0=Dk8Y=XF=loongson.cn=chenhuacai@kernel.org" designates 145.40.68.75 as permitted sender) smtp.mailfrom="SRS0=Dk8Y=XF=loongson.cn=chenhuacai@kernel.org" X-Rspamd-Server: rspam02 X-Stat-Signature: aweyw46ofiu6f4jt9otwf5bwky8ybx1f X-HE-Tag: 1656563498-206112 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: This series is in order to enable sparse-vmemmap for LoongArch. But LoongArch cannot use generic helpers directly because MIPS&LoongArch need to call pgd_init()/pud_init()/pmd_init() when populating page tables. So we adjust the prototypes of p?d_init() to make generic helpers can call them, then enable sparse-vmemmap with generic helpers, and to be further, generalise vmemmap_populate_hugepages() for ARM64, X86 and LoongArch. V1 -> V2: Split ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP to a separate patch. Huacai Chen and Feiyang Chen(4): MIPS&LoongArch: Adjust prototypes of p?d_init(). LoongArch: Add sparse memory vmemmap support. mm/sparse-vmemmap: Generalise vmemmap_populate_hugepages(). LoongArch: Enable ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP. Signed-off-by: Huacai Chen Signed-off-by: Feiyang Chen --- arch/arm64/mm/mmu.c | 53 ++++++-------------- arch/loongarch/Kconfig | 2 + arch/loongarch/include/asm/pgalloc.h | 13 +---- arch/loongarch/include/asm/pgtable.h | 13 +++-- arch/loongarch/include/asm/sparsemem.h | 8 +++ arch/loongarch/kernel/numa.c | 4 +- arch/loongarch/mm/init.c | 44 +++++++++++++++- arch/loongarch/mm/pgtable.c | 23 +++++---- arch/mips/include/asm/pgalloc.h | 8 +-- arch/mips/include/asm/pgtable-64.h | 8 +-- arch/mips/kvm/mmu.c | 3 +- arch/mips/mm/pgtable-32.c | 10 ++-- arch/mips/mm/pgtable-64.c | 18 ++++--- arch/mips/mm/pgtable.c | 2 +- arch/x86/mm/init_64.c | 92 ++++++++++++---------------------- include/linux/mm.h | 8 +++ include/linux/page-flags.h | 1 + mm/sparse-vmemmap.c | 64 +++++++++++++++++++++++ 18 files changed, 222 insertions(+), 152 deletions(-) -- 2.27.0