Commit:     ba72cb8cb0cdc0a65b3abe9a387f1a26bfd49b8a
Parent:     ee592a5bd5180cc1ffaf5acd7bf1e91e0d854a08
Author:     Mel Gorman <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 28 16:21:13 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Nov 29 09:24:51 2007 -0800

    Fix boot problem with iSeries lacking hugepage support
    Ordinarily the size of a pageblock is determined at compile-time based on 
    hugepage size. On PPC64, the hugepage size is determined at runtime based on
    what is supported by the machine. With legacy machines such as iSeries that
    do not support hugepages, HPAGE_SHIFT is 0. This results in pageblock_order
    being set to -PAGE_SHIFT and a crash results shortly afterwards.
    This patch adds a function to select a sensible value for pageblock order by
    default when HUGETLB_PAGE_SIZE_VARIABLE is set. It checks that HPAGE_SHIFT
    is a sensible value before using the hugepage size; if it is not MAX_ORDER-1
    is used.
    This is a fix for 2.6.24.
    Credit goes to Stephen Rothwell for identifying the bug and testing 
    patches.  Additional credit goes to Andy Whitcroft for spotting a problem
    with respects to IA-64 before releasing. Additional credit to David Gibson
    for testing with the libhugetlbfs test suite.
    Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
    Tested-by: Stephen Rothwell <[EMAIL PROTECTED]>
    Cc: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
    Acked-by: Paul Mackerras <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 arch/powerpc/Kconfig |    5 +++++
 mm/page_alloc.c      |   23 +++++++++++++++++++++--
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 18f397c..232c298 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -187,6 +187,11 @@ config FORCE_MAX_ZONEORDER
        default "9" if PPC_64K_PAGES
        default "13"
+       bool
+       depends on HUGETLB_PAGE
+       default y
        bool "Math emulation"
        depends on 4xx || 8xx || E200 || PPC_MPC832x || E500
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4ffed1c..b5a58d4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3265,6 +3265,16 @@ static void inline setup_usemap(struct pglist_data 
 #endif /* CONFIG_SPARSEMEM */
+/* Return a sensible default order for the pageblock size. */
+static inline int pageblock_default_order(void)
+               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)
-/* 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)
@@ -3365,7 +3384,7 @@ static void __meminit free_area_init_core(struct 
pglist_data *pgdat,
                if (!size)
-               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);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to