Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp489171rwi; Thu, 20 Oct 2022 01:04:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sqECqjWsR58+8Al0GC79xAZLp4Rn7SC3h4kH8/h/fBukWkzVWVm4smVbIIvgw+WUT2P8Z X-Received: by 2002:a17:907:2e19:b0:78e:281d:91fe with SMTP id ig25-20020a1709072e1900b0078e281d91femr10132293ejc.482.1666253092422; Thu, 20 Oct 2022 01:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666253092; cv=none; d=google.com; s=arc-20160816; b=oFFtTFG0cMbaRzeNms/Jyv8t5AqblmJihDP93MWGysjrzdDwfo3p/cYc+LFugE1DTA 99NWJfC3NJuz2FcC6CQ22LJKT65Fi/L7kPIpaNSbIyTZ/vnR+sq9+nK3m09/UVD2txgs 2052IQAChNR3kQsgIZRzTQ2lqTA1VJow7trdw7XheqjuL/mXSwmhIpdhfrZiBtCLIClj xgd/2dkfBSR2boZ6irMtbYaljMbVrT2hvmq/E/Rh640khHw8Xudq2E6hYqjJsVkyUhLw L5KRIdX+DQCxL0nzLp173y9k4woi/czWFtitLiWsmiD97g73ya5xMEaYWk02noPRerD7 xbgQ== 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=yAZ1ORJ3p+NmYDz5laTe7nu8RD/NClnbtZrChT7/sJ4=; b=rDTkcAgkfFxOGJ9mLJq1ziHTsz93JcnlIolih9CfukLtikSILcwzxt+oQNOSslGZm1 ksaAz0XG94FbtuMu890vAXJqVfycBx7mkulbwrvS40LpQ0uG92MMJWssnDxHoeUPwheD PAWqv6osY9KczACp+HwGFPYwViPlYI9rXKIQA+IGF/OsjZgcWmKrKEEbLJX1fJjcGnOG DLC43wGr6cAyB1ZH1DRh6CLtH+SHFz/oQ/wp530OOnln7tTeNlwSy+H4WH+3pS2a9ww6 NQ3+ZjgTt59RXWQuZvPMDVlNT4YdZo8DYQCqIkWE4VYmftHmLsAziXlfL6/2KEc/zqVc 5Mng== 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 js6-20020a17090797c600b0078b2fed72b9si11895619ejc.111.2022.10.20.01.04.26; Thu, 20 Oct 2022 01:04:52 -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 S229736AbiJTHZX (ORCPT + 99 others); Thu, 20 Oct 2022 03:25:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiJTHZS (ORCPT ); Thu, 20 Oct 2022 03:25:18 -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 38DDFD77C6; Thu, 20 Oct 2022 00:25:17 -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 D3136619C8; Thu, 20 Oct 2022 07:25:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4463CC433D7; Thu, 20 Oct 2022 07:25:11 +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 V12 0/4] mm/sparse-vmemmap: Generalise helpers and enable for LoongArch Date: Thu, 20 Oct 2022 15:23:13 +0800 Message-Id: <20221020072317.492906-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 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. V10 -> V11: Adjust context due to ARM64 changes in 6.1-rc1. V11 -> V12: 1, Fix build error for !SPARSEMEM; 2, Simplify pagetable_init() for MIPS32. 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