Re: [PATCH 03/19] mm: Mark special bits for huge pfn mappings when inject

Peter Xu
2024-08-14T15:23:47Z

On Wed, Aug 14, 2024 at 09:40:00AM -0300, Jason Gunthorpe wrote:
> On Fri, Aug 09, 2024 at 12:08:53PM -0400, Peter Xu wrote:
> > We need these special bits to be around to enable gup-fast on pfnmaps.
>
> It is not gup-fast you are after but follow_pfn/etc for KVM usage
> right?

Gup-fast needs it to make sure we don't pmd_page() it and fail early. So
still needed in some sort..

But yeah, this comment is ambiguous and not describing the whole picture,
as multiple places will so far rely this bit, e.g. fork() to identify a
private page or pfnmap. Similarly we'll do that in folio_walk_start(), and
follow_pfnmap. I plan to simplify that to:

We need these special bits to be around on pfnmaps. Mark properly for
!devmap case, reflecting that there's no page struct backing the entry.

>
> GUP family of functions should all fail on pfnmaps.
>
> > Mark properly for !devmap case, reflecting that there's no page struct
> > backing the entry.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > mm/huge_memory.c | 4 ++++
> > 1 file changed, 4 insertions(+)
>
> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

So I'll tentatively take this with the amended commit message, unless
there's objection.

Thanks,

--
Peter Xu