• David Hildenbrand's avatar
    mm/page_alloc.c: don't set pages PageReserved() when offlining · 0ee5f4f3
    David Hildenbrand authored
    Patch series "mm: Memory offlining + page isolation cleanups", v2.
    
    This patch (of 2):
    
    We call __offline_isolated_pages() from __offline_pages() after all
    pages were isolated and are either free (PageBuddy()) or PageHWPoison.
    Nothing can stop us from offlining memory at this point.
    
    In __offline_isolated_pages() we first set all affected memory sections
    offline (offline_mem_sections(pfn, end_pfn)), to mark the memmap as
    invalid (pfn_to_online_page() will no longer succeed), and then walk
    over all pages to pull the free pages from the free lists (to the
    isolated free lists, to be precise).
    
    Note that re-onlining a memory block will result in the whole memmap
    getting reinitialized, overwriting any old state.  We already poision
    the memmap when offlining is complete to find any access to
    stale/uninitialized memmaps.
    
    So, setting the pages PageReserved() is not helpful.  The memap is
    marked offline and all pageblocks are isolated.  As soon as offline, the
    memmap is stale either way.
    
    This looks like a leftover from ancient times where we initialized the
    memmap when adding memory and not when onlining it (the pages were set
    PageReserved so re-onling would work as expected).
    
    Link: http://lkml.kernel.org/r/20191021172353.3056-2-david@redhat.comSigned-off-by: default avatarDavid Hildenbrand <david@redhat.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Oscar Salvador <osalvador@suse.de>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Mike Rapoport <rppt@linux.ibm.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Wei Yang <richard.weiyang@gmail.com>
    Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
    Cc: Anshuman Khandual <anshuman.khandual@arm.com>
    Cc: Pavel Tatashin <pavel.tatashin@microsoft.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Pingfan Liu <kernelfans@gmail.com>
    Cc: Qian Cai <cai@lca.pw>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    0ee5f4f3
memory_hotplug.c 47.4 KB