hulk inclusion category: feature bugzilla: https://gitee.com/src-openeuler/kernel/issues/ID4NL4 ---------------------------------------- Add pte_clrhuge() helper function for arm64 to convert a huge PTE entry to regular PTE. This function provides the inverse operation of pte_mkhuge() and is needed when splitting huge page mappings, where individual PTE entries are created from the original huge page mapping. Signed-off-by: Yin Tirui <yintirui@huawei.com> --- arch/arm64/include/asm/pgtable.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 82b296805f87..32bd191ab952 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -251,6 +251,14 @@ static inline pte_t pte_mkpresent(pte_t pte) return set_pte_bit(pte, __pgprot(PTE_VALID)); } +static inline pte_t pte_clrhuge(pte_t pte) +{ + pteval_t mask = PTE_TYPE_MASK & ~PTE_VALID; + pteval_t val = PTE_TYPE_PAGE & ~PTE_VALID; + + return __pte((pte_val(pte) & ~mask) | val); +} + static inline pmd_t pmd_mkcont(pmd_t pmd) { return __pmd(pmd_val(pmd) | PMD_SECT_CONT); -- 2.43.0