• Ard Biesheuvel's avatar
    Revert "mm/page_alloc: fix memmap_init_zone pageblock alignment" · 3e04040d
    Ard Biesheuvel authored
    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: default avatarJan Glauber <jglauber@cavium.com>
    Tested-by: default avatarShanker Donthineni <shankerd@codeaurora.org>
    Cc: Daniel Vacek <neelx@redhat.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Paul Burton <paul.burton@imgtec.com>
    Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3e04040d
Name
Last commit
Last update
Documentation Loading commit data...
LICENSES Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...