pte_alloc_map() expects to be followed by pte_unmap(), but hugetlb omits
that: to keep balance in future, use the recently added pte_alloc_huge()
instead; with pte_offset_huge() a better name for pte_offset_kernel().

Signed-off-by: Hugh Dickins <hu...@google.com>
Acked-by: Catalin Marinas <catalin.mari...@arm.com>
---
 arch/arm64/mm/hugetlbpage.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 95364e8bdc19..21716c940682 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -307,14 +307,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, struct 
vm_area_struct *vma,
                        return NULL;
 
                WARN_ON(addr & (sz - 1));
-               /*
-                * Note that if this code were ever ported to the
-                * 32-bit arm platform then it will cause trouble in
-                * the case where CONFIG_HIGHPTE is set, since there
-                * will be no pte_unmap() to correspond with this
-                * pte_alloc_map().
-                */
-               ptep = pte_alloc_map(mm, pmdp, addr);
+               ptep = pte_alloc_huge(mm, pmdp, addr);
        } else if (sz == PMD_SIZE) {
                if (want_pmd_share(vma, addr) && pud_none(READ_ONCE(*pudp)))
                        ptep = huge_pmd_share(mm, vma, addr, pudp);
@@ -366,7 +359,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
                return (pte_t *)pmdp;
 
        if (sz == CONT_PTE_SIZE)
-               return pte_offset_kernel(pmdp, (addr & CONT_PTE_MASK));
+               return pte_offset_huge(pmdp, (addr & CONT_PTE_MASK));
 
        return NULL;
 }
-- 
2.35.3

Reply via email to