@@ -799,17 +799,18 @@ void __init init_cma_reserved_pageblock(struct page *page)
set_page_count(p, 0);
} while (++p, --i);
- set_page_refcounted(page);
- set_pageblock_migratetype(page, MIGRATE_CMA);
-
- if (pageblock_order > MAX_ORDER) {
- i = pageblock_order - MAX_ORDER;
+ if (pageblock_order >= MAX_ORDER) {
+ i = pageblock_order - MAX_ORDER + 1;
i = 1 << i;
p = page;
do {
- __free_pages(p, MAX_ORDER);
+ set_page_refcounted(p);
+ set_pageblock_migratetype(p, MIGRATE_CMA);
+ __free_pages(p, MAX_ORDER - 1);
} while (p += MAX_ORDER_NR_PAGES, --i);
} else {
+ set_page_refcounted(page);
+ set_pageblock_migratetype(page, MIGRATE_CMA);
__free_pages(page, pageblock_order);
}