• Heiko Carstens's avatar
    memory_hotplug: always initialize pageblock bitmap · 76cdd58e
    Heiko Carstens authored
    Trying to online a new memory section that was added via memory hotplug
    sometimes results in crashes when the new pages are added via __free_page.
     Reason for that is that the pageblock bitmap isn't initialized and hence
    contains random stuff.  That means that get_pageblock_migratetype()
    returns also random stuff and therefore
    
    	list_add(&page->lru,
    		&zone->free_area[order].free_list[migratetype]);
    
    in __free_one_page() tries to do a list_add to something that isn't even
    necessarily a list.
    
    This happens since 86051ca5 ("mm: fix
    usemap initialization") which makes sure that the pageblock bitmap gets
    only initialized for pages present in a zone.  Unfortunately for hot-added
    memory the zones "grow" after the memmap and the pageblock memmap have
    been initialized.  Which means that the new pages have an unitialized
    bitmap.  To solve this the calls to grow_zone_span() and grow_pgdat_span()
    are moved to __add_zone() just before ...
    76cdd58e
memory_hotplug.c 18.6 KB