With `pfn_pte()` now guaranteeing that it will natively filter out huge page attributes like `_PAGE_PSE`, the `pte_clrhuge()` helper has become obsolete. Remove `pte_clrhuge()` entirely. Concurrently, clean up the ugly type-casting anti-pattern in `arch/x86/mm/init_64.c` where `(pte_t *)` was forcibly cast from `pmd_t *` to call `pte_clrhuge()`. Now, we can simply extract the pgprot directly via `pmd_pgprot()` and safely pass it downstream, knowing that `pfn_pte()` will strip the huge bit automatically. Signed-off-by: Yin Tirui --- arch/x86/include/asm/pgtable.h | 5 ----- arch/x86/mm/init_64.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index a4dbd81d42bf..e8564d4ce318 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -483,11 +483,6 @@ static inline pte_t pte_mkhuge(pte_t pte) return pte_set_flags(pte, _PAGE_PSE); } -static inline pte_t pte_clrhuge(pte_t pte) -{ - return pte_clear_flags(pte, _PAGE_PSE); -} - static inline pte_t pte_mkglobal(pte_t pte) { return pte_set_flags(pte, _PAGE_GLOBAL); diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index d65f3d05c66f..a1ddcf793a8a 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -572,7 +572,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long paddr, unsigned long paddr_end, paddr_last = paddr_next; continue; } - new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd)); + new_prot = pmd_pgprot(*pmd); } if (page_size_mask & (1<