Re: [PATCH 2/4] mm: not __SetPageReserved on initializing hot-plugged memory

David Hildenbrand
2024-06-29T06:20:00Z

On 29.06.24 03:33, Wei Yang wrote:
> Initialize all pages reserved is an ancient behavior.
>
> Since commit 92923ca3aace ("mm: meminit: only set page reserved in the
> memblock region"), SetPageReserved is removed from
> __init_single_page(). Only those reserved pages are marked PG_reserved.
>
> But we still set PG_reserved on offline and check it on online.
>
> Following two commits removed both of them:
>
> * Commit 0ee5f4f31d36 ("mm/page_alloc.c: don't set pages PageReserved()
> when offlining") removed the set on offline.
> * Commit 5ecae6359e3a ("mm/memory_hotplug: drop PageReserved() check in
> online_pages_range()") removed the check on online.
>
> This means we set PG_reserved for hot-plugged memory at initialization
> is not helpful and a little different from bootmem initialization path.
> Now we can remove it.

It's not that easy for ZONE_DEVICE.

Also, see mm/mm-stable

commit 3dadec1babf9eee0c67c967df931d6f0cb124a04
Author: David Hildenbrand <david@redhat.com>
Date: Fri Jun 7 11:09:36 2024 +0200

mm: pass meminit_context to __free_pages_core()

Patch series "mm/memory_hotplug: use PageOffline() instead of
PageReserved() for !ZONE_DEVICE".

commit b873faaa609ab44c223b2327f55d2b6a2ba4ca9c
Author: David Hildenbrand <david@redhat.com>
Date: Fri Jun 7 11:09:37 2024 +0200

mm/memory_hotplug: initialize memmap of !ZONE_DEVICE with
PageOffline() instead of PageReserved()

If you want to work on removing it for ZONE_DEVICE, one idea
is to replace all relevant PageReserved() checks by a
more generic function that would check PageReserved() and the zone

--
Cheers,

David / dhildenb