Re: [PATCH 01/14] mm/memory_hotplug: remove for_each_valid_pfn() usage

Lorenzo Stoakes (Oracle)
2026-03-17T17:19:23Z

On Tue, Mar 17, 2026 at 05:56:39PM +0100, David Hildenbrand (Arm) wrote:
> When offlining memory, we know that the memory range has no holes.
> Checking for valid pfns is not required.
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>

Holey Cow! LGTM, so:

Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>

> ---
> mm/memory_hotplug.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 86d3faf50453..3495d94587e7 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1746,7 +1746,7 @@ static int scan_movable_pages(unsigned long start, unsigned long end,
> {
> unsigned long pfn;
>
> - for_each_valid_pfn(pfn, start, end) {
> + for (pfn = start; pfn < end; pfn++) {
> struct page *page;
> struct folio *folio;
>
> @@ -1791,7 +1791,7 @@ static void do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
> static DEFINE_RATELIMIT_STATE(migrate_rs, DEFAULT_RATELIMIT_INTERVAL,
> DEFAULT_RATELIMIT_BURST);
>
> - for_each_valid_pfn(pfn, start_pfn, end_pfn) {
> + for (pfn = start_pfn; pfn < end_pfn; pfn++) {
> struct page *page;
>
> page = pfn_to_page(pfn);
> --
> 2.43.0
>