aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 12376ae3f733..b5a58d476c1a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -305,7 +305,6 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
305{ 305{
306 int i; 306 int i;
307 307
308 VM_BUG_ON((gfp_flags & (__GFP_WAIT | __GFP_HIGHMEM)) == __GFP_HIGHMEM);
309 /* 308 /*
310 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO 309 * clear_highpage() will use KM_USER0, so it's a bug to use __GFP_ZERO
311 * and __GFP_HIGHMEM from hard or soft interrupt context. 310 * and __GFP_HIGHMEM from hard or soft interrupt context.
@@ -3266,6 +3265,16 @@ static void inline setup_usemap(struct pglist_data *pgdat,
3266#endif /* CONFIG_SPARSEMEM */ 3265#endif /* CONFIG_SPARSEMEM */
3267 3266
3268#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE 3267#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
3268
3269/* Return a sensible default order for the pageblock size. */
3270static inline int pageblock_default_order(void)
3271{
3272 if (HPAGE_SHIFT > PAGE_SHIFT)
3273 return HUGETLB_PAGE_ORDER;
3274
3275 return MAX_ORDER-1;
3276}
3277
3269/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ 3278/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */
3270static inline void __init set_pageblock_order(unsigned int order) 3279static inline void __init set_pageblock_order(unsigned int order)
3271{ 3280{
@@ -3281,7 +3290,16 @@ static inline void __init set_pageblock_order(unsigned int order)
3281} 3290}
3282#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ 3291#else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
3283 3292
3284/* Defined this way to avoid accidently referencing HUGETLB_PAGE_ORDER */ 3293/*
3294 * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order()
3295 * and pageblock_default_order() are unused as pageblock_order is set
3296 * at compile-time. See include/linux/pageblock-flags.h for the values of
3297 * pageblock_order based on the kernel config
3298 */
3299static inline int pageblock_default_order(unsigned int order)
3300{
3301 return MAX_ORDER-1;
3302}
3285#define set_pageblock_order(x) do {} while (0) 3303#define set_pageblock_order(x) do {} while (0)
3286 3304
3287#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ 3305#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
@@ -3366,7 +3384,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
3366 if (!size) 3384 if (!size)
3367 continue; 3385 continue;
3368 3386
3369 set_pageblock_order(HUGETLB_PAGE_ORDER); 3387 set_pageblock_order(pageblock_default_order());
3370 setup_usemap(pgdat, zone, size); 3388 setup_usemap(pgdat, zone, size);
3371 ret = init_currently_empty_zone(zone, zone_start_pfn, 3389 ret = init_currently_empty_zone(zone, zone_start_pfn,
3372 size, MEMMAP_EARLY); 3390 size, MEMMAP_EARLY);