Re: [PATCH V2 04/14] arm64/mm: Route all pgtable atomics to central helpers

From: Anshuman Khandual

Date: Thu Sep 17 2026 - 00:19:10 EST


On Wed, Sep 16, 2026 at 03:39:05PM +0200, David Hildenbrand (Arm) wrote:
> On 9/7/26 05:50, Anshuman Khandual wrote:
> > Route all cmpxchg() operations performed on various page table entries to a
> > new ptval_cmpxchg_relaxed() helper. Similarly route all xchg() operations
> > performed on page table entries to a new ptval_xchg_relaxed() helper.
> >
> > Currently these helpers just forward to the same APIs that were previously
> > called direct, but in future we will change the routing for D128 which is
> > too long to use the standard APIs.
> >
> > Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> > Cc: Will Deacon <will@xxxxxxxxxx>
> > Cc: Ryan Roberts <ryan.roberts@xxxxxxx>
> > Cc: Mark Rutland <mark.rutland@xxxxxxx>
> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> > ---
>
> [...]
>
> > case PAGE_SIZE:
> > @@ -1400,7 +1411,7 @@ static inline void ___ptep_set_wrprotect(struct mm_struct *mm,
> > do {
> > old_pte = pte;
> > pte = pte_wrprotect(pte);
> > - pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep),
> > + pte_val(pte) = ptval_cmpxchg_relaxed(&pte_val(*ptep),
> > pte_val(old_pte), pte_val(pte));
>
> Indentation goes out of sync here.
>
> > } while (pte_val(pte) != pte_val(old_pte));
> > }
> > @@ -1438,7 +1449,7 @@ static inline void __clear_young_dirty_pte(struct vm_area_struct *vma,
> > if (flags & CYDP_CLEAR_DIRTY)
> > pte = pte_mkclean(pte);
> >
> > - pte_val(pte) = cmpxchg_relaxed(&pte_val(*ptep),
> > + pte_val(pte) = ptval_cmpxchg_relaxed(&pte_val(*ptep),
> > pte_val(old_pte), pte_val(pte));
>
> Same here

OK - will fix the alignment on both the above instances.

>
> Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>
> --
> Cheers,
>
> David