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

Peter Xu
2025-04-25T20:00:54Z

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.

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

--
Peter Xu