Re: [PATCH v4 1/5] mm,memory_hotplug: Allocate memmap from the added memory range

From: Oscar Salvador
Date: Thu Mar 18 2021 - 08:04:55 EST


On Thu, Mar 18, 2021 at 12:24:16PM +0100, David Hildenbrand wrote:
> I don't follow. 2MB == 2MB. And if there would be difference then we would
> be in the problem I brought up: vmemmap code allocating too much via the
> altmap, which can be very bad because might be populating more vmemmap than
> we actually need.

Yes, I meant to say nr_vmemmap_pages won't match, or IOW, won't have the
same meaning.
The end result is the same.

> vmemmap_size = 512 * 4KiB = 2 MiB.
>
> That calculation wasn't very useful (/ PAGE_SIZE * PAGE_SIZE)?

Yeah, somewhat redundant.

>
> > unsigned long remaining_size = size - vmemmap_size;
>
> And here we could get something like
>
> remaining_size = 2 GiB - 2 MiB

Yes, vmemmap_size would need to scale with nr_sections to be relative to
size.

Just wanted to bring it up, because somene might wonder
"ok, why do we have altmap->nr_pfns = X, and here nr_vmemmap_pages
is Y"

It was an effort to make it consistent, although I see it would bring
more confusion other than anything, so disregard.

--
Oscar Salvador
SUSE L3