Commit f2d2f9598ebb ("mm: introduce and use {pgd,p4d}_populate_kernel()")
made kernel top-level page table synchronization part of the generic
pgd_populate_kernel() and p4d_populate_kernel() helpers.
Since vmemmap page table population now goes through these helpers,
the extra sync_global_pgds() in vmemmap_populate() is redundant.
Remove it to simplify the code and reduce the sync overhead.
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
arch/x86/mm/init_64.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 77b889b71cf3..5b9d7e88f066 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1559,24 +1559,20 @@ int __meminit vmemmap_check_pmd(pmd_t *pmd, int node,
int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
struct vmem_altmap *altmap)
{
- int err;
-
VM_BUG_ON(!PAGE_ALIGNED(start));
VM_BUG_ON(!PAGE_ALIGNED(end));
if (end - start < PAGES_PER_SECTION * sizeof(struct page))
- err = vmemmap_populate_basepages(start, end, node, NULL);
- else if (boot_cpu_has(X86_FEATURE_PSE))
- err = vmemmap_populate_hugepages(start, end, node, altmap);
- else if (altmap) {
+ return vmemmap_populate_basepages(start, end, node, NULL);
+ if (boot_cpu_has(X86_FEATURE_PSE))
+ return vmemmap_populate_hugepages(start, end, node, altmap);
+ if (altmap) {
pr_err_once("%s: no cpu support for altmap allocations\n",
__func__);
- err = -ENOMEM;
- } else
- err = vmemmap_populate_basepages(start, end, node, NULL);
- if (!err)
- sync_global_pgds(start, end - 1);
- return err;
+ return -ENOMEM;
+ }
+
+ return vmemmap_populate_basepages(start, end, node, NULL);
}
#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE
base-commit: e98d21c170b01ddef366f023bbfcf6b31509fa83
--
2.54.0