riscv/mm: fix missing destructor for hotplug PUD tables

Commit 8472cc4503 ("riscv: mm: call PUD/P4D ctor in special kernel
pgtable alloc") made alloc_pud_late() run the PUD page-table constructor.
However, free_pud_table() still frees non-reserved PUD tables directly
without decrementing NR_PAGETABLE.

Free PUD tables through the common free_pgtable_page() helper so that
constructor-backed tables run the matching destructor before being
freed.

Link: https://lore.kernel.org/[email protected]
Fixes: 8472cc4503 ("riscv: mm: call PUD/P4D ctor in special kernel pgtable alloc")
Signed-off-by: Muchun Song <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Björn Töpel <[email protected]>
Reviewed-by: Kevin Brodsky <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Paul Walmsley <[email protected]>
Cc: Palmer Dabbelt <[email protected]>
Cc: Albert Ou <[email protected]>
Cc: Alexandre Ghiti <[email protected]>
Cc: Björn Töpel <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Alistair Popple <[email protected]>
Cc: <[email protected]>
This commit is contained in:
Muchun Song
2026-11-09 22:44:26 -08:00
committed by Andrew Morton
parent 352fca06aa
commit fbf197512f
+1 -4
View File
@@ -1553,10 +1553,7 @@ static void __meminit free_pud_table(pud_t *pud_start, p4d_t *p4d)
return;
}
if (PageReserved(page))
free_reserved_page(page);
else
__free_pages(page, 0);
free_pgtable_page(page);
p4d_clear(p4d);
}