Re: [RFC PATCH 01/57] mm: add pte_folio()

From: Rik van Riel

Date: Tue Aug 18 2026 - 16:11:07 EST


On Tue, 2026-08-18 at 20:13 +0200, David Hildenbrand (Arm) wrote:
> On 8/18/26 18:38, Rik van Riel wrote:
> > On Sun, 2026-08-16 at 23:45 +0100, Kiryl Shutsemau wrote:
> > > From: "Kiryl Shutsemau (Meta)" <kas@xxxxxxxxxx>
> > >
> > > Callers that want the folio behind a present PTE spell it out as
> > > page_folio(pte_page(pte)).
> > >
> > > Add pte_folio() as the folio companion to pte_page(), and convert
> > > the
> > > callers in fs/proc/task_mmu.c and mm/hugetlb.c.
> > >
> > > Preparation for the anonymous collapse engine, which reads the
> > > folio
> > > behind a PTE in several places.
> > >
> > > Assisted-by: Claude-Code:claude-opus-5
> > > Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
> >
> > Oh nice, this could clean up some things in the
> > get_user_pages code too, when we get around to
> > tech debt there.
>
> We really need the page in GUP code ...

Ugh, indeed. COW can create "holes" in the middle of
a large folio, so even __access_remote_vm() will
continue to need pages.

I guess we'll continue to look up both page and
folio in that code, then :/

--
All Rights Reversed.