Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3837518rwi; Sun, 16 Oct 2022 19:46:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4s9c38g42W0CeTttA2qo9k9P6iPFu3ZVKmpMPxtF8ZcAqSIsk083H3LbvWT8/0s3qEMYOw X-Received: by 2002:a17:902:eb8e:b0:17f:637b:9548 with SMTP id q14-20020a170902eb8e00b0017f637b9548mr9737732plg.158.1665974801041; Sun, 16 Oct 2022 19:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665974801; cv=none; d=google.com; s=arc-20160816; b=W4orWmtR27iutWt6GU1nxLlpennvDeGqluds2ylb8L24tn44Ic27CfVtZS8tpA+sxj I3AklP3yqRNXUUKLcO4JndpkDrkKT05yr8DqTi1uFxAzbQHYtN+Z9eW/1Y3tIrhI1b4J grqq9QXEanYM7pAC5E/z8yw/FHR4RGS2FCM1Kv5owSon+pEhaHHzKmrRJ3sb3bsnP0n0 CMyUJdGL1Z21MgpNyVDD8A/e2me7NBTqbjSaO23jIHiAbhbFyBglVnX9BBEN6NNuQlRf XXKT2da6ugAGGbrSaIY679vsfbCs62qTa0TfjBWQlFJkOJNtTV+brpBTiHh5iWZsWgeA 7w/w== 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=rsqdBp0Vf0C4NKHVhjVGvwAmAlLMZunAxwToQ/ysmKY=; b=mBgynborSQ69XAr1PD1yRkBboL3a4thDZ8Hasc1MN6ajfHuCZEPgaqnyMquiFvrjZS 5CyxONqbJxHNFejtvwyQraQNu8LfF9cumLj508NGh6YpcPg8qFgmO7TE/oCEGOo0D4Lx PLG7OoQoLHpqIbCCSokKXhLiWmKRb3NdNCafC5S1pa4tTt2YDQpvdo5eykCsm3h1+tJB 6nlg5JNH9WGK4SKhE1Ty2gWVG8+27MsCeF7u1gncz2B8EQlmVm8cqIHXoR+xVxGnA1pz EOIfDgB1sT/exYZ3kQ63EFlkccD/Ok2pohGpajqdwpOE3JWtU4jCGsoDTU6KHwoyAOgk bH4w== 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 r20-20020a170902c7d400b0017f1cd24493si9638652pla.50.2022.10.16.19.46.29; Sun, 16 Oct 2022 19:46:41 -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 S231220AbiJQCmT (ORCPT + 99 others); Sun, 16 Oct 2022 22:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231214AbiJQCmR (ORCPT ); Sun, 16 Oct 2022 22:42:17 -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 F311146841; Sun, 16 Oct 2022 19:42:15 -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 8C00460EF9; Mon, 17 Oct 2022 02:42:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1925DC433C1; Mon, 17 Oct 2022 02:42:09 +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 V11 0/4] mm/sparse-vmemmap: Generalise helpers and enable for LoongArch Date: Mon, 17 Oct 2022 10:40:23 +0800 Message-Id: <20221017024027.2389370-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. 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