Re: [PATCH RESEND v2 07/21] mm/pgtable: define (pgd|p4d|pud)_offset_lockless() for folded page tables
From: Yeoreum Yun
Date: Mon Nov 30 2026 - 06:19:47 EST
On Mon, Nov 30, 2026 at 12:07:17PM +0100, David Hildenbrand (Arm) wrote:
> On 11/30/26 11:53, Yeoreum Yun wrote:
> > On Mon, Nov 30, 2026 at 11:40:18AM +0100, David Hildenbrand (Arm) wrote:
> >> On 11/30/26 10:24, Yeoreum Yun wrote:
> >>> Hi David,
> >>>
> >>>
> >>> Thanks. I'll add with
> >>>
> >>> Fixes: d3f7b1bb2049 ("mm/gup: fix gup_fast with dynamic page table folding")
> >>>
> >>> where applied pXd_offset_lockless() with stack value in the generic implemenation.
> >>
> >> Is this something we want to CC stable and merge early?
> >
> > Agree. But I'm testing build on the latest mm-unstable again.
>
> Please send against mm-core/for-next :)
>
> > After above. I'd like to send the v3 series with below commit message
> > for this patch:
> >
> > mm/pgtable: define (pgd|p4d|pud)_offset_lockless() for folded page tables
> >
> > The default helpers fallback to pud_offset(), passing a pointer to the
> > stack value.
> >
> > Let's provide variants that do exactly what (pgd|p4d|pud)_offset() do,
> > but ignore the passed pgd_t/p4d_t/pud_t, consequently not working on a
> > pointer to the stack value like the default handlers would.
> >
> > With this patch, Drop the arm64 custom variant that did that. As it documents:
> >
> > Note: reusing the original pointer means that it may be
> > dereferenced the same (live) page-table entry multiple times.
> > This is safe because it is still only loaded once in the
> > context of each level and the CPU guarantees same-address
> > read-after-read ordering.
> >
> > Do not document this, as the double read will be removed in the next patch.
> >
> > Also, this patch fixes the pXd leaf recheck in fast GUP to read the live
> > entry rather than a stack copy, ensuring that concurrent mapping changes
> > are detected when the pXd level is folded.
> >
> > Fixes: Fixes: d3f7b1bb2049 ("mm/gup: fix gup_fast with dynamic page table folding")
> > Cc: <stable@xxxxxxxxxxxxxxx>
> > Signed-off-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> >
> > Or, do you want to post this patch separately first?
>
> Is it possible to move this fix to #1 in the series? then we can easily decide
> what to do.
Okay. once checked based on mm-core/for-next, I'll post v3 with above.
Thanks ;)
--
Sincerely,
Yeoreum Yun