mm: fix set pageblock migratetype in deferred struct page init
authorXishi Qiu <[email protected]>
Fri, 7 Oct 2016 23:58:09 +0000 (16:58 -0700)
committerLinus Torvalds <[email protected]>
Sat, 8 Oct 2016 01:46:27 +0000 (18:46 -0700)
commite780149bcd4be171421535db0514fa9ff556cb87
treebec57321e6f8ce606d8a6e716aabb8cc7b176c32
parente506b99696a296e9aba2e5f3bc5768aa7d8e2396
mm: fix set pageblock migratetype in deferred struct page init

On x86_64 MAX_ORDER_NR_PAGES is usually 4M, and a pageblock is usually
2M, so we only set one pageblock's migratetype in deferred_free_range()
if pfn is aligned to MAX_ORDER_NR_PAGES.  That means it causes
uninitialized migratetype blocks, you can see from "cat
/proc/pagetypeinfo", almost half blocks are Unmovable.

Also we missed freeing the last block in deferred_init_memmap(), it
causes memory leak.

Fixes: ac5d2539b238 ("mm: meminit: reduce number of times pageblocks are set during struct page init")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Xishi Qiu <[email protected]>
Cc: Taku Izumi <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: "Kirill A . Shutemov" <[email protected]>
Cc: Kamezawa Hiroyuki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/page_alloc.c