x86-mm-use-ptdesc-when-freeing-pmd-pages.patch removed from -mm tree
The quilt patch titled
Subject: x86/mm: use 'ptdesc' when freeing PMD pages
has been removed from the -mm tree. Its filename was
x86-mm-use-ptdesc-when-freeing-pmd-pages.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Dave Hansen <[email protected]>
Subject: x86/mm: use 'ptdesc' when freeing PMD pages
Date: Wed, 22 Oct 2025 16:26:30 +0800
There are a billion ways to refer to a physical memory address. One of the x86 PMD freeing code location chooses to use a 'pte_t *' to point to a PMD page and then call a PTE-specific freeing function for it. That's a bit wonky.
Just use a 'struct ptdesc *' instead. Its entire purpose is to refer to page table pages. It also means being able to remove an explicit cast.
Right now, pte_free_kernel() is a one-liner that calls pagetable_dtor_free(). Effectively, all this patch does is remove one superfluous __pa(__va(paddr)) conversion and then call pagetable_dtor_free() directly instead of through a helper.
---
arch/x86/mm/pgtable.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/x86/mm/pgtable.c renamed from arch/x86/mm/pgtable.c~x86-mm-use-ptdesc-when-freeing-pmd-pages +6 -6
@@ -729,7 +729,7 @@ int pmd_clear_huge(pmd_t *pmd)int pud_free_pmd_page (pud_t *pud,unsigned long addr) {pmd_t *pmd, *pmd_sv; -pte_t *pte; +struct ptdesc *pt;int i; pmd =pud_pgtable (*pud);
@@ -750,8 +750,8 @@ int pud_free_pmd_page(pud_t *pud, unsignfor (i =0 ; i <PTRS_PER_PMD ; i++) {if (!pmd_none (pmd_sv[i])) { - pte = (pte_t *)pmd_page_vaddr (pmd_sv[i]); -pte_free_kernel (&init_mm, pte); + pt =page_ptdesc (pmd_page (pmd_sv[i])); +pagetable_dtor_free (pt); } }
@@ -772,15 +772,15 @@ int pud_free_pmd_page(pud_t *pud, unsign*/ int pmd_free_pte_page (pmd_t *pmd,unsigned long addr) { -pte_t *pte; +struct ptdesc *pt; - pte = (pte_t *)pmd_page_vaddr (*pmd); + pt =page_ptdesc (pmd_page (*pmd));pmd_clear (pmd);/* INVLPG to clear all paging-structure caches */ flush_tlb_kernel_range (addr, addr +PAGE_SIZE -1 ); -pte_free_kernel (&init_mm, pte); +pagetable_dtor_free (pt);return 1 ; }
_
Patches currently in -mm which might be from [email protected] are