[RFC PATCH 24/34] x86: mm: call try_to_free_pmd_page() when CONFIG_PGTABLE_LEVELS > 2
Yeoreum Yun
yeoreum.yun at arm.com
Mon Jul 13 06:56:03 PDT 2026
We want to rework how pgd_page_vaddr() behaves for generic compile-time
folded page tables by disallowing its use and triggering a compile-time
error when it is used improperly, ensuring that the actual
first-level pXd_pgtable() function is used instead.
The try_to_free_pmd_page() wouldn't need to call when
CONFIG_PGTABLE_LEVELS=2. therefore call it when CONFIG_PGTABLE_LEVELS > 2.
There should be no functional change.
Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
---
arch/x86/mm/pat/set_memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index cffb1cef869cc..2137174b733ae 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -1452,7 +1452,7 @@ static bool unmap_pte_range(pmd_t *pmd, unsigned long start, unsigned long end)
static void __unmap_pmd_range(pud_t *pud, pmd_t *pmd,
unsigned long start, unsigned long end)
{
- if (unmap_pte_range(pmd, start, end))
+ if (unmap_pte_range(pmd, start, end) && CONFIG_PGTABLE_LEVELS > 2)
if (try_to_free_pmd_page(pud_pgtable(*pud)))
pud_clear(pud);
}
@@ -1496,7 +1496,7 @@ static void unmap_pmd_range(pud_t *pud, unsigned long start, unsigned long end)
/*
* Try again to free the PMD page if haven't succeeded above.
*/
- if (!pud_none(*pud))
+ if (!pud_none(*pud) && CONFIG_PGTABLE_LEVELS > 2)
if (try_to_free_pmd_page(pud_pgtable(*pud)))
pud_clear(pud);
}
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
More information about the kvm-riscv
mailing list