Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2490010rwb; Mon, 15 Aug 2022 06:26:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR6r76k6cWYhpBMyjSiVm8p45p89AMEmZUkYQABnmM3cGpHrxIML5sMr05DY/LiGk3i7qelX X-Received: by 2002:a17:907:7355:b0:730:664f:91f with SMTP id dq21-20020a170907735500b00730664f091fmr10477024ejc.400.1660570008336; Mon, 15 Aug 2022 06:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660570008; cv=none; d=google.com; s=arc-20160816; b=NbgLe3VA0L4t4JIgYOJf8rl6is7BNK6HNR8cFlXoQ/TBKgc0FKYCV8JGB4WPz/J4R/ rjPc2J9OqIW+VIYkH32sDkr8xEiHFrpCCi+WuchAjtgjWDBkgcP6kY0rxsxZRuYKu+yq ZsNoLhx74HuPBhMwNiZaU35FJ9Jt4WktCyuTxm7FjnJ3YkJ5DL56UG0omckYgYI2ww+B wxUPl08urdlB9oJoz2wfWNWt0s9U5oS3NwY0+BE2RP83n9clCq3ij6S8SCpqPiu24uPp XrAZTwsek9WGZkxaAD/76rx3/OH1fGiSMGsZbP5ODLdPcV6MvhbAwwF61ojAuBg3y+/D PuNw== 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 :message-id:date:subject:cc:to:from; bh=IqlUi2xy7knf+GhJE9vEkVfaFwkiE0KetYe9SKNlqf0=; b=hNLCrRKnSIxzpHA3P4ZzZBiWHru7Xo6EXB4cSQxh5u5Emd05oAxMZtqL/EmQ/U3j0q wCSiVo3ObFXMG/C5BzZAP1F49eIAZzuGotDm4JNrJrLnKJOsV3473wwAKdu6EgMjnVM7 gTknSikEdbfs1TJF3aEMyJQ3jyZKupoOm0H1ZGTL3yaCikP/ebOxdQmYFNL/P8YWci/Q QDKTnUCKoNFkkh4cE8bK90EpLxzW2fUT/4tCNPHG0fy6pELATXWuBEtTvRedM1Q4jO+p PT0huLa/sCX5v/txBDJyqK1Fi9xMXNtdA/9o8t4sDXfVww0DZFsjXG9cEAukMuM6KVhC j+UQ== 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 gr23-20020a170906e2d700b0071576eb9e6bsi6901717ejb.211.2022.08.15.06.26.23; Mon, 15 Aug 2022 06:26:48 -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 S231989AbiHOMgm (ORCPT + 99 others); Mon, 15 Aug 2022 08:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbiHOMgj (ORCPT ); Mon, 15 Aug 2022 08:36:39 -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 130711A3BC; Mon, 15 Aug 2022 05:36:38 -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 A1F0B611C6; Mon, 15 Aug 2022 12:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1637DC433C1; Mon, 15 Aug 2022 12:36:31 +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 V10 0/4] mm/sparse-vmemmap: Generalise helpers and enable for LoongArch Date: Mon, 15 Aug 2022 20:36:09 +0800 Message-Id: <20220815123613.3291770-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.31.1 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 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". V7 -> V8: Fix build error for MIPS pud_init(). V8 -> V9: Remove redundant #include to avoid build error with latest upstream kernel. V9 -> V10: Fix build error due to VMEMMAP changes in 6.0-rc1. 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