Since contpte_test_and_clear_young_ptes() and contpte_clear_flush_young_ptes have already performed CONT_PTE_SIZE alignment and will clear the young flag for the entire cont block, Their non-batched callers do not need to pass in 'CONT_PTES' to specify the cont block range. Otherwise, it may exceed the range of a single cont block for the non-batched cases. Signed-off-by: Baolin Wang --- Hi Andrew, As I conducted more tests, I found that the ptep_test_and_clear_young() operation may clear the young flag beyond a single cont block range, causing issues. Please fold this fixup into this patch to solve this issue. Thanks. --- arch/arm64/include/asm/pgtable.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index d5fbe72e820a..5e9ff16146c3 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1823,7 +1823,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, if (likely(!pte_valid_cont(orig_pte))) return __ptep_test_and_clear_young(vma, addr, ptep); - return contpte_test_and_clear_young_ptes(vma, addr, ptep, CONT_PTES); + return contpte_test_and_clear_young_ptes(vma, addr, ptep, 1); } #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH @@ -1835,7 +1835,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, if (likely(!pte_valid_cont(orig_pte))) return __ptep_clear_flush_young(vma, addr, ptep); - return contpte_clear_flush_young_ptes(vma, addr, ptep, CONT_PTES); + return contpte_clear_flush_young_ptes(vma, addr, ptep, 1); } #define wrprotect_ptes wrprotect_ptes -- 2.47.3