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

Anshuman Khandual anshuman.khandual at arm.com
Wed Sep 16 21:18:49 PDT 2026


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 at arm.com>
> > Cc: Will Deacon <will at kernel.org>
> > Cc: Ryan Roberts <ryan.roberts at arm.com>
> > Cc: Mark Rutland <mark.rutland at arm.com>
> > Cc: linux-arm-kernel at lists.infradead.org
> > Cc: linux-kernel at vger.kernel.org
> > Signed-off-by: Anshuman Khandual <anshuman.khandual at arm.com>
> > ---
> 
> [...]
> 
> >  	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 at kernel.org>
> 
> -- 
> Cheers,
> 
> David



More information about the linux-arm-kernel mailing list