Re: [PATCH v2] mm/page_vma_mapped_walk: Use ptep_get_lockless() for lockless access
From: Alexander Gordeev
Date: Thu May 07 2026 - 06:33:04 EST
On Thu, May 07, 2026 at 09:34:33AM +0000, Wei Yang wrote:
> >@@ -310,7 +310,7 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> > goto restart;
> > }
> > pvmw->pte++;
> >- } while (pte_none(ptep_get(pvmw->pte)));
> >+ } while (pte_none(ptep_get_lockless(pvmw->pte)));
>
> As Oscar mentioned in lkml.org/lkml/2026/4/27/630, map_pte() may take the
> lock. So probably it is not right?
If I read the code correctly map_pte() might take the lock, but also
might not take it. If it took the lock and uses ptep_get_lockless(),
then it is fine. But if it did not take the lock and uses ptep_get(),
then it is an issue.
> >
> > if (!pvmw->ptl) {
> > spin_lock(ptl);
> >--
> >2.51.0
> >
>
> --
> Wei Yang
Thanks!