[PATCH -next v6 5/6] arm64/mm: Enable ARCH_SUPPORTS_PAGE_TABLE_CHECK

Catalin Marinas catalin.marinas at arm.com
Wed May 4 10:26:43 PDT 2022


On Tue, May 03, 2022 at 09:13:20AM +0800, Tong Tiangen wrote:
> 在 2022/4/29 14:18, Anshuman Khandual 写道:
> > On 4/26/22 13:40, Tong Tiangen wrote:
> > > @@ -884,7 +928,11 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
> > >   static inline pmd_t pmdp_huge_get_and_clear(struct mm_struct *mm,
> > >   					    unsigned long address, pmd_t *pmdp)
> > >   {
> > > -	return pte_pmd(ptep_get_and_clear(mm, address, (pte_t *)pmdp));
> > > +	pmd_t pmd = pte_pmd(__pte(xchg_relaxed(&pte_val(*(pte_t *)pmdp), 0)));
> > 
> > Why there is any change here ? Why not just the following instead, like what you did
> > in ptep_get_and_clear() above. The page table entry return value here just needs to
> > be preserved for subsequent page table check helpers.
> > 
> > 	pmd_t pmd = pte_pmd(ptep_get_and_clear(mm, address, (pte_t *)pmdp));
> 
> The purpose of what I do here is to avoid doing page_table_check_pte_clear()
> in ptep_get_and_clear(). there is no functional change here.

I'm fine with using xchg here but I'd go for pmd_val directly, no need
for conversion to pte_t:

	pmd_t pmd = __pmd(xchg_relaxed(&pmd_val(*pmdp), 0));

-- 
Catalin



More information about the linux-riscv mailing list