]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "mm/page_alloc: fix memmap_init_zone pageblock alignment"
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 14 Mar 2018 19:29:37 +0000 (19:29 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 14 Mar 2018 23:33:28 +0000 (16:33 -0700)
commit25ce7bd8a5f749f1d79b915d7179385b878218b2
tree6aa6d607f562ab2804bfe1ee94a4afcc296e4590
parent811154eb0e67378d8c0d83ad0b4ce2378f1ff718
Revert "mm/page_alloc: fix memmap_init_zone pageblock alignment"

This reverts commit ed8fca465708c44d7630c2c344fa372461a8b481.

Commit ed8fca465708 ("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 ed8fca465708 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: ed8fca465708 ("mm/page_alloc: fix memmap_init_zone pageblock alignment")
Tested-by: Jan Glauber <jglauber@cavium.com>
Tested-by: Shanker 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: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c