Re: Memory hotplug not increasing the total RAM

From: Michal Hocko
Date: Tue Jan 30 2018 - 13:29:54 EST


On Tue 30-01-18 13:11:06, Pavel Tatashin wrote:
> Hi Michal,
>
> Thank you for taking care of the problem. The patch may introduce a
> small performance regression during normal boot, as we add a branch
> into a hot initialization path. But, it fixes a current problem, so:
>
> Reviewed-by: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>

Thanks!

> However, I think we should change the hotplug code to also not to
> touch the map area until struct pages are initialized.
>
> Currently, we loop through "struct page"s several times during memory hotplug:
>
> 1. memset(0) in sparse_add_one_section()
> 2. loop in __add_section() to set do: set_page_node(page, nid); and
> SetPageReserved(page);
> 3. loop in pages_correctly_reserved() to check that SetPageReserved is set.
> 4. loop in memmap_init_zone() to call __init_single_pfn()

You might be very well correct but the hotplug code is quite subtle and
we do depend on PageReserved at some unexpected places so it is not that
easy I am afraid. My TODO list in the hotplug is quite long. If you feel
like you want to work on that I would be more than happy.
--
Michal Hocko
SUSE Labs