• Pavel Tatashin's avatar
    mm/sparse: add new sparse_init_nid() and sparse_init() · 85c77f79
    Pavel Tatashin authored
    sparse_init() requires to temporary allocate two large buffers: usemap_map
    and map_map.  Baoquan He has identified that these buffers are so large
    that Linux is not bootable on small memory machines, such as a kdump boot.
    The buffers are especially large when CONFIG_X86_5LEVEL is set, as they
    are scaled to the maximum physical memory size.
    
    Baoquan provided a fix, which reduces these sizes of these buffers, but it
    is much better to get rid of them entirely.
    
    Add a new way to initialize sparse memory: sparse_init_nid(), which only
    operates within one memory node, and thus allocates memory either in large
    contiguous block or allocates section by section.  This eliminates the
    need for use of temporary buffers.
    
    For simplified bisecting and review temporarly call sparse_init()
    new_sparse_init(), the new interface is going to be enabled as well as old
    code removed in the next patch.
    
    Link: http://lkml.kernel.org/r/20180712203730.8703-5-pasha.tatashin@oracle.comSigned-off-by: default avatarPavel Tatashin <pasha.tatashin@oracle.com>
    Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
    Tested-by: default avatarOscar Salvador <osalvador@suse.de>
    Tested-by: Michael Ellerman <mpe@ellerman.id.au>	[powerpc]
    Cc: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
    Cc: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
    Cc: Baoquan He <bhe@redhat.com>
    Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Dave Hansen <dave.hansen@intel.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Jérôme Glisse <jglisse@redhat.com>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Souptick Joarder <jrdr.linux@gmail.com>
    Cc: Steven Sistare <steven.sistare@oracle.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Wei Yang <richard.weiyang@gmail.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    85c77f79
sparse.c 27 KB