Commit 3e04040d authored by Committed by Linus Torvalds
Revert "mm/page_alloc: fix memmap_init_zone pageblock alignment"
This reverts commit 864b75f9. Commit 864b75f9 ("mm/page_alloc: fix memmap_init_zone pageblock alignment") modified the logic in memmap_init_zone() to initialize struct pages associated with invalid PFNs, to appease a VM_BUG_ON() in move_freepages(), which is redundant by its own admission, and dereferences struct page fields to obtain the zone without checking whether the struct pages in question are valid to begin with. Commit 864b75f9 only makes it worse, since the rounding it does may cause pfn assume the same value it had in a prior iteration of the loop, resulting in an infinite loop and a hang very early in the boot. Also, since it doesn't perform the same rounding on start_pfn itself but only on intermediate values following an invalid PFN, we may still hit the same VM_BUG_ON() as before. So instead, let's fix this at the core, and ensure that the BUG check doesn't dereference struct page fields of invalid pages. Fixes: 864b75f9 ("mm/page_alloc: fix memmap_init_zone pageblock alignment") Tested-by: Jan Glauber <firstname.lastname@example.org> Tested-by: Shanker Donthineni <email@example.com> Cc: Daniel Vacek <firstname.lastname@example.org> Cc: Mel Gorman <email@example.com> Cc: Michal Hocko <firstname.lastname@example.org> Cc: Paul Burton <email@example.com> Cc: Pavel Tatashin <firstname.lastname@example.org> Cc: Vlastimil Babka <email@example.com> Cc: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Ard Biesheuvel <email@example.com> Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Showing with 5 additions and 8 deletions