Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp21013imw; Mon, 4 Jul 2022 04:36:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v1baHjrpRKhvq6hTgr+nKhCFCrdk856v4ko9TBuICG9zBEZwwxIVygm8h+HhFhFrGRDHd5 X-Received: by 2002:a17:907:9816:b0:726:2b90:4bab with SMTP id ji22-20020a170907981600b007262b904babmr28569121ejc.544.1656934611407; Mon, 04 Jul 2022 04:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656934611; cv=none; d=google.com; s=arc-20160816; b=UPbnKHDsqlpQV9zraJliYyTkbzUaQGAeKqjqbKDsdIT5OZ6qACtICsw8mbG9j7ygzN XlrhDNhcPyUOtLhiaHrD6XaG8gIfMi+QzEBxyzaa8JrowzQZcyDmkQxgmMg16lDF+6gh pomZ6INMlh9JRzNMFk02udV3k8WfC5+fmx5OQEsvLNcyy7yDfdlWSnDzj/TDh+Cd7vFW cz1UWafBVRYNwbfkUVTsWW8bJqi/DY6lDJdSZDqRHw2HXV1EuBi5Qnblia5Xg6wxjTOP ErzRirMl4yZL41oFItahGGIPqcHeuFYQTRftjRX6fUQ3JXMgB3DGwaQyqf5S4nSY0eMz OmxA== 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=TjDaXLcDtGPigoKINT7LXeJOuYNE7LKEl5F4NmmsNkM=; b=0QeaWo0cB8R0VVO4aL6kAjnPvAKK/3KlIlkM3RefR9OCZG6ZUhIrWHX8LUB+eSiOAr SYNerq8CUHQKW1avBHn3XJdMjKe+l0E3PJzyjDrrGGErl/KlbHzXmrZoOeDCi98xPC3e PzuHfoFq5eCHzX2uPmvrUc9dhp/XAgTIZyUDoBeAd9s5BJZFn82ze752WcBh2tqSUeJt Qc0pPgs9p82dG18Lx62oL1EmGV7jkNnRUmwSXK8tuHS6FosAbPWdE0+P1pLM0jmInWLF TLR3++Cw1kFeXCTBwqQB7oFH2V7R0tpOtaQWjZhq3C+IcdfmC5KGwSNkppR+zR4zQJM+ B0mg== 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 hg2-20020a1709072cc200b0072a6779a9afsi7892194ejc.249.2022.07.04.04.36.24; Mon, 04 Jul 2022 04:36:51 -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 S233346AbiGDLYm (ORCPT + 99 others); Mon, 4 Jul 2022 07:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232744AbiGDLYl (ORCPT ); Mon, 4 Jul 2022 07:24:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A171DF97; Mon, 4 Jul 2022 04:24:40 -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 ams.source.kernel.org (Postfix) with ESMTPS id EB346B80EDF; Mon, 4 Jul 2022 11:24:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4650C341CD; Mon, 4 Jul 2022 11:24:32 +0000 (UTC) From: Huacai Chen To: Arnd Bergmann , Huacai Chen , Thomas Bogendoerfer , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Catalin Marinas , Will Deacon 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 V4 0/4] mm/sparse-vmemmap: Generalise helpers and enable for LoongArch Date: Mon, 4 Jul 2022 19:25:22 +0800 Message-Id: <20220704112526.2492342-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. Huacai Chen and Feiyang Chen(4): MIPS&LoongArch: 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