Re: [PATCH] mm, page_alloc: fix build_zonerefs_node()

From: Michal Hocko
Date: Thu Apr 07 2022 - 07:48:21 EST

On Thu 07-04-22 13:40:25, Michal Hocko wrote:
> Now to your patch. I suspect this is not sufficient for the full hotplug
> situation. Consider a new NUMA node to be hotadded. hotadd_new_pgdat
> will call build_all_zonelists but the zone is not populated yet at that
> moment unless I am missing something. We do rely on online_pages to
> rebuild once pages are onlined - which usually means they are freed to
> the page allocator.

OK, I've managed to get lost in the code and misread the onlining part.
After re-reading the code I have concluded that the patch is good as is.
online_pages relies on zone_populated so it will pass and zonelists will
be regenerated even without any pages freed to the allocator. Sorry for
the confusion. But I guess this still proves my other point that the
code is really subtle and messy so I guess the less rebuilding we do the
better. There are two ways, go with your patch and do the clean up on
top or merge the two.

That being said
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
to your patch with an improved changelog to be more specific about the
underlying problem.

Thanks and sorry for the confusion.
Michal Hocko