• David Hildenbrand's avatar
    mm/memory_hotplug: don't access uninitialized memmaps in shrink_zone_span() · b5ca5acb
    David Hildenbrand authored
    commit 7ce700bf upstream.
    
    Let's limit shrinking to !ZONE_DEVICE so we can fix the current code.
    We should never try to touch the memmap of offline sections where we
    could have uninitialized memmaps and could trigger BUGs when calling
    page_to_nid() on poisoned pages.
    
    There is no reliable way to distinguish an uninitialized memmap from an
    initialized memmap that belongs to ZONE_DEVICE, as we don't have
    anything like SECTION_IS_ONLINE we can use similar to
    pfn_to_online_section() for !ZONE_DEVICE memory.
    
    E.g., set_zone_contiguous() similarly relies on pfn_to_online_section()
    and will therefore never set a ZONE_DEVICE zone consecutive.  Stopping
    to shrink the ZONE_DEVICE therefore results in no observable changes,
    besides /proc/zoneinfo indicating different boundaries - something we
    can totally live with.
    
    Before commit d0dc12e8 ("mm/memory_hotplug: optimize memory
    hotplug"), the memmap was initi...
    b5ca5acb
memory_hotplug.c 49.5 KB