Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2550333rwb; Sat, 6 Aug 2022 01:04:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4KPR36HqofzSmY9VKzXCpTiegzk+MxBxP5oOEjlWD+naGqxMqw6e0eIB4CdeNxV4Togev5 X-Received: by 2002:a05:6402:400b:b0:43d:b0a1:dee with SMTP id d11-20020a056402400b00b0043db0a10deemr9812654eda.223.1659773093955; Sat, 06 Aug 2022 01:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659773093; cv=none; d=google.com; s=arc-20160816; b=UvsoJUTqYUVqYafLBkxvnXfei860ampME4dEeSZjwqMSWInkdx3fRNhqQ0C9EEZntL On6PZCIB7+hgKP9IaPjQWEiA6fwK89oSN/HOvPTfaE3LHPwwASUcoJeLmim4yoroDNME QSGWs7rcmu/4g83ngfDHc8xetQRaK9A3N9J7Yh5BKoiN0XrTfYL4P2PTHx2mSxdO0GcH hThprJHvk5AZASci4fnp9NlGxR8OzYGurlLuuP2naMDkGYCdmxemlNJHU5tWGvyEyqFW 6U4i7InYM8+bLvhFBm0SOsuJpD/4tlsb9EwClOLtodvTp29r2AIkw10MkQE20QVhfAoZ 0ySQ== 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=SD1T+cRsH7QvQQTHCusDx8vnztStCDWbJhnpg/RSqnU=; b=0E7kAeN1YREnU1GbnpQXy943q984fDZJnuRClppacYbELpMuPnZTMpNHQnHTW9ATBc X70RbK7LRUOGV2EP6jFsd3AcIO+KV3/goB7Qwl2w7sIAZxl2nutcBoPEH0MVaxGVmY9R PovSxMdYhnBFuZIZm3PnS3ncnTE3HCLq6GJia47oRjVY7LrTbAPDqfpJ9JpX484uWQju MdB4CEb3avkKq+287WJdkgN8Aqkt36/aKWzuZcnnYxZV5sEytUp65GasltOH1SiSrK1y UbMSyL8ubOLu4nNkkIVTO1PQmcquaqLPc0ZeAu10XbXydIJVaE5GfTLqbnlKF7GPJjHu jSkw== 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 qb42-20020a1709077eaa00b00730b62beb0bsi5658404ejc.185.2022.08.06.01.04.29; Sat, 06 Aug 2022 01:04:53 -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 S241718AbiHFHzk (ORCPT + 99 others); Sat, 6 Aug 2022 03:55:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241722AbiHFHzi (ORCPT ); Sat, 6 Aug 2022 03:55:38 -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 7E68B12D06; Sat, 6 Aug 2022 00:55:37 -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 227FB60BFC; Sat, 6 Aug 2022 07:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E69EC433C1; Sat, 6 Aug 2022 07:55:30 +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 V8 0/4] mm/sparse-vmemmap: Generalise helpers and enable for LoongArch Date: Sat, 6 Aug 2022 15:55:22 +0800 Message-Id: <20220806075526.1735954-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(). 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