linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone
@ 2018-03-13 22:42 Daniel Vacek
  2018-03-14 14:17 ` Michal Hocko
  2018-03-15 14:08 ` Jia He
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Vacek @ 2018-03-13 22:42 UTC (permalink / raw)
  To: linux-kernel, linux-mm
  Cc: Sudeep Holla, Naresh Kamboju, Daniel Vacek, Andrew Morton,
	Mel Gorman, Michal Hocko, Paul Burton, Pavel Tatashin,
	Vlastimil Babka, stable

On some architectures (reported on arm64) commit 864b75f9d6b01 ("mm/page_alloc: fix memmap_init_zone pageblock alignment")
causes a boot hang. This patch fixes the hang making sure the alignment
never steps back.

Link: http://lkml.kernel.org/r/0485727b2e82da7efbce5f6ba42524b429d0391a.1520011945.git.neelx@redhat.com
Fixes: 864b75f9d6b01 ("mm/page_alloc: fix memmap_init_zone pageblock alignment")
Signed-off-by: Daniel Vacek <neelx@redhat.com>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
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: <stable@vger.kernel.org>
---
 mm/page_alloc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3d974cb2a1a1..e033a6895c6f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5364,9 +5364,14 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
 			 * is not. move_freepages_block() can shift ahead of
 			 * the valid region but still depends on correct page
 			 * metadata.
+			 * Also make sure we never step back.
 			 */
-			pfn = (memblock_next_valid_pfn(pfn, end_pfn) &
+			unsigned long next_pfn;
+
+			next_pfn = (memblock_next_valid_pfn(pfn, end_pfn) &
 					~(pageblock_nr_pages-1)) - 1;
+			if (next_pfn > pfn)
+				pfn = next_pfn;
 #endif
 			continue;
 		}
-- 
2.16.2

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-16  0:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 22:42 [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone Daniel Vacek
2018-03-14 14:17 ` Michal Hocko
2018-03-15  1:30   ` Daniel Vacek
2018-03-15 11:50     ` Michal Hocko
2018-03-15 14:53       ` Daniel Vacek
2018-03-15 14:08 ` Jia He
2018-03-15 15:39   ` Daniel Vacek
2018-03-16  0:45     ` Jia He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox