Re: [PATCH v1 04/11] mm/memremap: convert to pfnmap_track() + pfnmap_untrack()

Lorenzo Stoakes
2025-04-28T16:55:22Z

On Fri, Apr 25, 2025 at 04:00:42PM -0400, Peter Xu wrote:
> On Fri, Apr 25, 2025 at 10:17:08AM +0200, David Hildenbrand wrote:
> > Let's use the new, cleaner interface.
> >
> > Signed-off-by: David Hildenbrand <david@redhat.com>
> > ---
> > mm/memremap.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/mm/memremap.c b/mm/memremap.c
> > index 2aebc1b192da9..c417c843e9b1f 100644
> > --- a/mm/memremap.c
> > +++ b/mm/memremap.c
> > @@ -130,7 +130,7 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
> > }
> > mem_hotplug_done();
> >
> > - untrack_pfn(NULL, PHYS_PFN(range->start), range_len(range), true);
> > + pfnmap_untrack(PHYS_PFN(range->start), range_len(range));
> > pgmap_array_delete(range);
> > }
> >
> > @@ -211,8 +211,8 @@ static int pagemap_range(struct dev_pagemap *pgmap, struct mhp_params *params,
> > if (nid < 0)
> > nid = numa_mem_id();
> >
> > - error = track_pfn_remap(NULL, &params->pgprot, PHYS_PFN(range->start), 0,
> > - range_len(range));
> > + error = pfnmap_track(PHYS_PFN(range->start), range_len(range),
> > + &params->pgprot);
> > if (error)
> > goto err_pfn_remap;
> >
> > @@ -277,7 +277,7 @@ static int pagemap_range(struct dev_pagemap *pgmap, struct mhp_params *params,
> > if (!is_private)
> > kasan_remove_zero_shadow(__va(range->start), range_len(range));
> > err_kasan:
> > - untrack_pfn(NULL, PHYS_PFN(range->start), range_len(range), true);
> > + pfnmap_untrack(PHYS_PFN(range->start), range_len(range));
>
> Not a huge deal, but maybe we could merge this and previous patch? It
> might be easier to reference the impl when reading the call site changes.

Agreed, it would add a sort of built-in justification for the prior patch
as in 'here is where we use it, this is why I'm doing this' kind of thing
also.

And I think this is small enough combined with the previous to not be a big
deal to have both together.

Thanks!

>
> > err_pfn_remap:
> > pgmap_array_delete(range);
> > return error;
> > --
> > 2.49.0
> >
>
> --
> Peter Xu
>