Skip to content

Commit e68b823

Browse files
Baolin Wangtorvalds
authored andcommitted
arm64/hugetlb: Fix building errors in huge_ptep_clear_flush()
Fix the arm64 build error which was caused by commit ae07562 ("mm: change huge_ptep_clear_flush() to return the original pte") interacting with commit fb396bb ("arm64/hugetlb: Drop TLB flush from get_clear_flush()"): arch/arm64/mm/hugetlbpage.c: In function ‘huge_ptep_clear_flush’: arch/arm64/mm/hugetlbpage.c:515:9: error: implicit declaration of function ‘get_clear_flush’; did you mean ‘ptep_clear_flush’? [-Werror=implicit-function-declaration] 515 | return get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig); | ^~~~~~~~~~~~~~~ | ptep_clear_flush Due to the new get_clear_contig() has dropped TLB flush, we should add an explicit TLB flush in huge_ptep_clear_flush() to keep original semantics when changing to use new get_clear_contig(). Fixes: fb396bb ("arm64/hugetlb: Drop TLB flush from get_clear_flush()"). Fixes: ae07562 ("mm: change huge_ptep_clear_flush() to return the original pte") Reported-and-tested-by: Linux Kernel Functional Testing <lkft@linaro.org> Reported-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Suggested-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 189b0dd commit e68b823

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

arch/arm64/mm/hugetlbpage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,12 +507,15 @@ pte_t huge_ptep_clear_flush(struct vm_area_struct *vma,
507507
{
508508
size_t pgsize;
509509
int ncontig;
510+
pte_t orig_pte;
510511

511512
if (!pte_cont(READ_ONCE(*ptep)))
512513
return ptep_clear_flush(vma, addr, ptep);
513514

514515
ncontig = find_num_contig(vma->vm_mm, addr, ptep, &pgsize);
515-
return get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig);
516+
orig_pte = get_clear_contig(vma->vm_mm, addr, ptep, pgsize, ncontig);
517+
flush_tlb_range(vma, addr, addr + pgsize * ncontig);
518+
return orig_pte;
516519
}
517520

518521
static int __init hugetlbpage_init(void)

0 commit comments

Comments
 (0)