• Dan Williams's avatar
    mm/sparsemem: introduce a SECTION_IS_EARLY flag · 326e1b8f
    Dan Williams authored
    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-cai@lca.pw/
    Link: http://lkml.kernel.org/r/156092350358.979959.5817209875548072819.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    Reported-by: default avatarQian Cai <cai@lca.pw>
    Tested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>	[ppc64]
    Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Logan Gunthorpe <logang@deltatee.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Jane Chu <jane.chu@oracle.com>
    Cc: Jeff Moyer <jmoyer@redhat.com>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Mike Rapoport <rppt@linux.ibm.com>
    Cc: Toshi Kani <toshi.kani@hpe.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Wei Yang <richardw.yang@linux.intel.com>
    Cc: Jason Gunthorpe <jgg@mellanox.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    326e1b8f
sparse.c 21.4 KB