On Tue, 2019-06-18 at 22:51 -0700, Dan Williams wrote:
> In preparation for sub-section hotplug, track whether a given section
> was created during early memory initialization, or later via memory
> hotplug.  This distinction is needed to maintain the coarse
> expectation
> that pfn_valid() returns true for any pfn within a given section even
> if
> that section has pages that are reserved from the page allocator.
> 
> For example one of the of goals of subsection hotplug is to support
> cases where the system physical memory layout collides System RAM and
> PMEM within a section. Several pfn_valid() users expect to just check
> if
> a section is valid, but they are not careful to check if the given
> pfn
> is within a "System RAM" boundary and instead expect pgdat
> information
> to further validate the pfn.
> 
> Rather than unwind those paths to make their pfn_valid() queries more
> precise a follow on patch uses the SECTION_IS_EARLY flag to maintain
> the
> traditional expectation that pfn_valid() returns true for all early
> sections.
> 
> Link: https://lore.kernel.org/lkml/1560366952-10660-1-git-send-email-
> c...@lca.pw/
> Reported-by: Qian Cai <c...@lca.pw>
> Cc: Michal Hocko <mho...@suse.com>
> Cc: Logan Gunthorpe <log...@deltatee.com>
> Cc: David Hildenbrand <da...@redhat.com>
> Cc: Oscar Salvador <osalva...@suse.de>
> Cc: Pavel Tatashin <pasha.tatas...@soleen.com>
> Signed-off-by: Dan Williams <dan.j.willi...@intel.com>

[...]
> @@ -731,7 +732,7 @@ int __meminit sparse_add_one_section(int nid,
> unsigned long start_pfn,
>       page_init_poison(memmap, sizeof(struct page) *
> PAGES_PER_SECTION);
>  
>       section_mark_present(ms);
> -     sparse_init_one_section(ms, section_nr, memmap, usage);
> +     sparse_init_one_section(ms, section_nr, memmap, usage, 0);

I think this is an improvment, and I really like the idea of leveraring
a new section's flag for this, but I have mixed feelings about the way
to mark a section as an early one.
IMHO, I think that a new "section_mark_early" function would be better
than passing a new flag parameter to sparse_init_one_section().

But I do not feel strong on this:

Reviewed-by: Oscar Salvador <osalva...@suse.de>


-- 
Oscar Salvador
SUSE L3

Reply via email to