Re: [PATCH v5 1/1] mm: refactor initialization of struct page for holes in memory layout

From: Mike Rapoport
Date: Sun Feb 14 2021 - 12:30:17 EST


On Fri, Feb 12, 2021 at 10:56:19AM +0100, David Hildenbrand wrote:
> On 12.02.21 10:55, David Hildenbrand wrote:
> > On 08.02.21 12:08, Mike Rapoport wrote:
> > > +#ifdef CONFIG_SPARSEMEM
> > > + /*
> > > + * Sections in the memory map may not match actual populated
> > > + * memory, extend the node span to cover the entire section.
> > > + */
> > > + *start_pfn = round_down(*start_pfn, PAGES_PER_SECTION);
> > > + *end_pfn = round_up(*end_pfn, PAGES_PER_SECTION);
> >
> > Does that mean that we might create overlapping zones when one node
>
> s/overlapping zones/overlapping nodes/
>
> > starts in the middle of a section and the other one ends in the middle
> > of a section?
>
> > Could it be a problem? (e.g., would we have to look at neighboring nodes
> > when making the decision to extend, and how far to extend?)

Having a node end/start in a middle of a section would be a problem, but in
this case I don't see a way to detect how a node should be extended :(

We can return to a v4 [1] without x86 modifications.
With that we'll have struct pages corresponding to a hole in a middle of a
zone with correct zone link and a good guess for the node.

As for the pfn 0 on x86, it'll remain outside any node and zone, but since
it was the case since, like forever, I think we can live with it.

[1] https://lore.kernel.org/lkml/20210130221035.4169-1-rppt@xxxxxxxxxx

--
Sincerely yours,
Mike.