summaryrefslogtreecommitdiff
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorLuka Pivk <luka.pivk@toradex.com>2019-01-08 07:02:41 +0100
committerLuka Pivk <luka.pivk@toradex.com>2019-01-08 07:02:41 +0100
commit43f61e8df71c474cd56b5c971096b9cf8d36cd95 (patch)
tree0031be65fcc2fd2fd3eceeee9558b5526a19e431 /mm/page_alloc.c
parent5656ec50dc9950db865d53306326b1a732e3738e (diff)
parentc04c050f5bf98845bfe22164b8a1503d696a6e26 (diff)
Merge remote-tracking branch 'remotes/origin/linux-4.19.y'toradex_4.19.y
Signed-off-by: Luka Pivk <luka.pivk@toradex.com>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6a62b2421cdf..93e73ccb4dec 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5538,6 +5538,18 @@ not_early:
cond_resched();
}
}
+#ifdef CONFIG_SPARSEMEM
+ /*
+ * If the zone does not span the rest of the section then
+ * we should at least initialize those pages. Otherwise we
+ * could blow up on a poisoned page in some paths which depend
+ * on full sections being initialized (e.g. memory hotplug).
+ */
+ while (end_pfn % PAGES_PER_SECTION) {
+ __init_single_page(pfn_to_page(end_pfn), end_pfn, zone, nid);
+ end_pfn++;
+ }
+#endif
}
static void __meminit zone_init_free_lists(struct zone *zone)
@@ -7704,11 +7716,14 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count,
* handle each tail page individually in migration.
*/
if (PageHuge(page)) {
+ struct page *head = compound_head(page);
+ unsigned int skip_pages;
- if (!hugepage_migration_supported(page_hstate(page)))
+ if (!hugepage_migration_supported(page_hstate(head)))
goto unmovable;
- iter = round_up(iter + 1, 1<<compound_order(page)) - 1;
+ skip_pages = (1 << compound_order(head)) - (page - head);
+ iter += skip_pages - 1;
continue;
}