Re: [PATCH] mm/memory_hotplug: Print the correct pfn in do_migrate_range()

From: Anshuman Khandual
Date: Tue Sep 24 2024 - 06:50:27 EST




On 9/24/24 15:45, Li Zhijian wrote:
> The pfn value needs to be retrieved correctly when PageTransHuge(page)

Where the pfn could have been modified with

pfn = page_to_pfn(head) + compound_nr(head) - 1

So retrieving from page will get the original pfn value ?

> is true. Fix it by replacing the usage of 'pfn' with 'page_to_pfn(page)'
> to ensure the correct pfn is printed in warning messages when isolation
> fails.
>
> Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
> ---
> mm/memory_hotplug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 26790c8d5b43..000430406a9e 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1829,7 +1829,7 @@ static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
>
> } else {
> if (__ratelimit(&migrate_rs)) {
> - pr_warn("failed to isolate pfn %lx\n", pfn);
> + pr_warn("failed to isolate pfn %lx\n", page_to_pfn(page));
> dump_page(page, "isolation failed");
> }
> }