Re: mapcount corruption regression

From: Yi Zhang
Date: Wed Dec 02 2020 - 17:42:55 EST


Hi Dan
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index dfd82f51ba66..7ed99314dcdf 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -829,6 +829,7 @@ int pud_free_pmd_page(pud_t *pud, unsigned long addr)
}

free_page((unsigned long)pmd_sv);
+ pgtable_pmd_page_dtor(virt_to_page(pmd));
free_page((unsigned long)pmd);

return 1;

In 2013 Kirill noticed that he missed a pmd page table free site:

c283610e44ec x86, mm: do not leak page->ptl for pmd page tables

In 2018 Toshi added a new pmd page table free site without the destructor:

28ee90fe6048 x86/mm: implement free pmd/pte page interfaces

In 2020 Willy adds PG_table accounting that flags the missing
pgtable_pmd_page_dtor()

Yi, I would appreciate a confirmation that the fix works for you.

I applied the patch to v5.10-rc3 ~ v5.10-rc6, and cannot reproduce this issue with my regression test now, feel free to add:
Tested-by: Yi Zhang <yi.zhang@xxxxxxxxxx>


Thanks
Yi