[PATCH 39/49] mm/sparse-vmemmap: remove unused ptpfn argument

Muchun Song
2026-04-05T12:57:46Z

The ptpfn argument is unused as it is assigned unconditionally before
being used in vmemmap_pte_populate(). Let's remove it.

Signed-off-by: Muchun Song <songmuchun@bytedance.com>
---
mm/sparse-vmemmap.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index c70275717054..36e5bcb5ba9b 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -149,8 +149,7 @@ static inline struct zone *section_to_zone(const struct mem_section *ms, int nid
}

static pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node,
- struct vmem_altmap *altmap,
- unsigned long ptpfn)
+ struct vmem_altmap *altmap)
{
pte_t entry, *pte = pte_offset_kernel(pmd, addr);

@@ -175,17 +174,15 @@ static pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, in
*/
if (slab_is_available())
get_page(page);
- ptpfn = page_to_pfn(page);

/* Remap shared tail page read-only to catch illegal writes. */
- entry = pfn_pte(ptpfn, PAGE_KERNEL_RO);
+ entry = pfn_pte(page_to_pfn(page), PAGE_KERNEL_RO);
} else {
void *p = vmemmap_alloc_block_buf(PAGE_SIZE, node, altmap);

if (!p)
return NULL;
- ptpfn = PHYS_PFN(__pa(p));
- entry = pfn_pte(ptpfn, PAGE_KERNEL);
+ entry = pfn_pte(PHYS_PFN(__pa(p)), PAGE_KERNEL);
}
set_pte_at(&init_mm, addr, pte, entry);

@@ -255,8 +252,7 @@ static pgd_t * __meminit vmemmap_pgd_populate(unsigned long addr, int node)
}

static pte_t * __meminit vmemmap_populate_address(unsigned long addr, int node,
- struct vmem_altmap *altmap,
- unsigned long ptpfn)
+ struct vmem_altmap *altmap)
{
pgd_t *pgd;
p4d_t *p4d;
@@ -276,7 +272,7 @@ static pte_t * __meminit vmemmap_populate_address(unsigned long addr, int node,
pmd = vmemmap_pmd_populate(pud, addr, node);
if (!pmd)
return NULL;
- pte = vmemmap_pte_populate(pmd, addr, node, altmap, ptpfn);
+ pte = vmemmap_pte_populate(pmd, addr, node, altmap);
if (!pte)
return NULL;
vmemmap_verify(pte, node, addr, addr + PAGE_SIZE);
@@ -292,7 +288,7 @@ int __meminit vmemmap_populate_basepages(unsigned long start, unsigned long end,
pte_t *pte;

for (; addr < end; addr += PAGE_SIZE) {
- pte = vmemmap_populate_address(addr, node, altmap, -1);
+ pte = vmemmap_populate_address(addr, node, altmap);
if (!pte)
return -ENOMEM;
}
--
2.20.1