From 2aac5f19763ea460d20ecdbe0c8f192abdd65e6f Mon Sep 17 00:00:00 2001 From: Mel Gorman Date: Wed, 28 Nov 2007 16:21:13 -0800 Subject: [PATCH] --- yaml --- r: 74345 b: refs/heads/master c: ba72cb8cb0cdc0a65b3abe9a387f1a26bfd49b8a h: refs/heads/master i: 74343: faf90db35839f83bad9a3be684094f385ccef0f1 v: v3 --- [refs] | 2 +- trunk/arch/powerpc/Kconfig | 5 +++++ trunk/mm/page_alloc.c | 23 +++++++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 1692f41ce665..6bd463d5c648 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ee592a5bd5180cc1ffaf5acd7bf1e91e0d854a08 +refs/heads/master: ba72cb8cb0cdc0a65b3abe9a387f1a26bfd49b8a diff --git a/trunk/arch/powerpc/Kconfig b/trunk/arch/powerpc/Kconfig index 18f397ca05ef..232c298c933f 100644 --- a/trunk/arch/powerpc/Kconfig +++ b/trunk/arch/powerpc/Kconfig @@ -187,6 +187,11 @@ config FORCE_MAX_ZONEORDER default "9" if PPC_64K_PAGES default "13" +config HUGETLB_PAGE_SIZE_VARIABLE + bool + depends on HUGETLB_PAGE + default y + config MATH_EMULATION bool "Math emulation" depends on 4xx || 8xx || E200 || PPC_MPC832x || E500 diff --git a/trunk/mm/page_alloc.c b/trunk/mm/page_alloc.c index 4ffed1cd158b..b5a58d476c1a 100644 --- a/trunk/mm/page_alloc.c +++ b/trunk/mm/page_alloc.c @@ -3265,6 +3265,16 @@ static void inline setup_usemap(struct pglist_data *pgdat, #endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE + +/* Return a sensible default order for the pageblock size. */ +static inline int pageblock_default_order(void) +{ + if (HPAGE_SHIFT > PAGE_SHIFT) + return HUGETLB_PAGE_ORDER; + + return MAX_ORDER-1; +} + /* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ static inline void __init set_pageblock_order(unsigned int order) { @@ -3280,7 +3290,16 @@ static inline void __init set_pageblock_order(unsigned int order) } #else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ -/* Defined this way to avoid accidently referencing HUGETLB_PAGE_ORDER */ +/* + * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order() + * and pageblock_default_order() are unused as pageblock_order is set + * at compile-time. See include/linux/pageblock-flags.h for the values of + * pageblock_order based on the kernel config + */ +static inline int pageblock_default_order(unsigned int order) +{ + return MAX_ORDER-1; +} #define set_pageblock_order(x) do {} while (0) #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ @@ -3365,7 +3384,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat, if (!size) continue; - set_pageblock_order(HUGETLB_PAGE_ORDER); + set_pageblock_order(pageblock_default_order()); setup_usemap(pgdat, zone, size); ret = init_currently_empty_zone(zone, zone_start_pfn, size, MEMMAP_EARLY);