Re: [RFC PATCH v3 2/4] mm,memory_hotplug: Allocate memmap from the added memory range

From: Oscar Salvador
Date: Wed Dec 09 2020 - 06:51:59 EST


On Wed, Dec 09, 2020 at 11:32:26AM +0100, Oscar Salvador wrote:
> On Wed, Dec 02, 2020 at 11:05:53AM +0100, David Hildenbrand wrote:
> > If you take a look at generic_online_page() there are some things that
> > won't be done for our vmemmap pages
> >
> > 1. kernel_map_pages(page, 1 << order, 1);
> >
> > We're accessing these pages already when initializing the memmap. We
> > might have to explicitly map these vmemmap pages at some point. Might
> > require some thought. Did you test with debug pagealloc?
>
> I always try to run with all debug stuff enabled, but I definitely
> did not enable debug_pagealloc.
> I will have a look at it.
>
> > 2. totalram_pages_add(1UL << order);
> >
> > We should add/remove the vmemmap pages manually from totalram I guess.
>
> Yes, we should. That was a clear oversight.

Looking closer, I do not think we have to account those into totalram.
I might be mistaken but looking at memblock_free_all, it seems we only
account to totalram_pages those ranges laying in memblock.memory filtering
out memblock.reserved.

And it seems that the pages we use for pglist_data structs (the ones we handle
in register_page_bootmem_info_node) fall in memblock.reserved.

--
Oscar Salvador
SUSE L3