Re: [PATCH] mm/memory_hotplug: maintain N_NORMAL_MEMORY during hotplug

From: Hao Li

Date: Sat Mar 28 2026 - 00:09:45 EST


On Fri, Mar 27, 2026 at 04:22:52PM +0100, David Hildenbrand (Arm) wrote:
> On 3/27/26 15:44, Vlastimil Babka (SUSE) wrote:
> > On 3/27/26 15:38, Joshua Hahn wrote:
> >> On Fri, 27 Mar 2026 20:42:47 +0800 Hao Li <hao.li@xxxxxxxxx> wrote:
> >>
> >> Hello Hao,
> >>
> >> I hope you are doing well, thank you for the patch!
> >>
> >>> N_NORMAL_MEMORY is initialized from zone population at boot, but memory
> >>> hotplug currently only updates N_MEMORY. As a result, a node that gains
> >>> normal memory via hotplug can remain invisible to users iterating over
> >>> N_NORMAL_MEMORY, while a node that loses its last normal memory can stay
> >>> incorrectly marked as such.
> >>
> >> The second part feels more important than the second part, doing a quick
> >> glance through the code I can see a few N_NORMAL_MEMORY iterators that
> >
> > Note in practice it's unlikely that a node would hotplug normal memory,
> > start using it, and then manage to successfully hotremove it, due to
> > unmovable allocations. Most likely only ZONE_MOVABLE memory can get hotremoved.
>
> Yes, hotunplug of all normal memory of a node is unlikely. Possible, but
> nothing to optimize for.

Yes, I agree that fully hot-unplugging the last normal-memory node is probably
uncommon.

That said, once we restore the set side, clearing it feels like the symmetric
counterpart as well. If we leave the clear side as-is, it seems like it could
be a bit confusing for others later on.

--
Thanks,
Hao