From patchwork Tue Aug 2 10:05:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 12934454 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 4731BC3F6B0 for ; Tue, 2 Aug 2022 10:05:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9537C8E0001; Tue, 2 Aug 2022 06:05:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 902D66B0072; Tue, 2 Aug 2022 06:05:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7F1D38E0001; Tue, 2 Aug 2022 06:05:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6F87B6B0071 for ; Tue, 2 Aug 2022 06:05:14 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 487E1160E6F for ; Tue, 2 Aug 2022 10:05:14 +0000 (UTC) X-FDA: 79754219748.11.1C454A1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 5A7491A00F3 for ; Tue, 2 Aug 2022 10:05:13 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 4035D60F62; Tue, 2 Aug 2022 10:05:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EA14C433C1; Tue, 2 Aug 2022 10:05:06 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Huacai Chen , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon , Dinh Nguyen 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 V7 0/4] mm/sparse-vmemmap: Generalise helpers and enable for LoongArch Date: Tue, 2 Aug 2022 18:05:09 +0800 Message-Id: <20220802100513.1303717-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of "SRS0=Jpgk=YG=loongson.cn=chenhuacai@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=Jpgk=YG=loongson.cn=chenhuacai@kernel.org"; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659434713; a=rsa-sha256; cv=none; b=cJnU5MaS15OL7IZcAS18KW4WjtdiLqVTINrzNbRZcmuyiIwVzx3XvAoaaEw5WVdor+1fnc rBZwCLlA9CC0SXNfT/luQLae+CV04qODRchq12gAiTtVd4twcqrSBNwKzKDKWHdZ6JLSfX e/vRz53iFmKhCAp1DIKiHY0qK8A8+fA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659434713; 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=/SLPWC5IgYflq3h9sRWQDpY4djcgl5T+pPhUzVOjStA=; b=q7+QTWfIyJjewQasH54MhEHJPnZiZPkyUW7hZdgV1eHOu5hVyXYJlBXathhiA9F/JJo1xG cdjhKxvUCYX/DjnkkFFgPUUFX9vIWCEaxMrb/NqDBvICW/6nHY7PxhTItUccoENHOJYI0F 1bnicQYl7S3ae3e6O2sZwl0BCV19lB4= X-Stat-Signature: utkq1wpwu1jczdwpykh3prqqrki41hb6 X-Rspamd-Queue-Id: 5A7491A00F3 Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of "SRS0=Jpgk=YG=loongson.cn=chenhuacai@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=Jpgk=YG=loongson.cn=chenhuacai@kernel.org"; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1659434713-776389 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. V2 -> V3: 1, Change the Signed-off-by order of author and committer; 2, Update commit message about the build error on LoongArch. V3 -> V4: Change pmd to pmdp for ARM64 for consistency. V4 -> V5: Add a detailed comment for no-fallback in the altmap case. V5 -> V6: 1, Fix build error for NIOS2; 2, Fix build error for allnoconfig; 3, Update comment for no-fallback in the altmap case. V6 -> V7: Fix build warnings of "no previous prototype". Huacai Chen and Feiyang Chen(4): MIPS&LoongArch&NIOS2: 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