|
@@ -3265,6 +3265,16 @@ static void inline setup_usemap(struct pglist_data *pgdat,
|
|
#endif /* CONFIG_SPARSEMEM */
|
|
#endif /* CONFIG_SPARSEMEM */
|
|
|
|
|
|
#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
|
|
#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 */
|
|
/* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */
|
|
static inline void __init set_pageblock_order(unsigned int order)
|
|
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 */
|
|
#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)
|
|
#define set_pageblock_order(x) do {} while (0)
|
|
|
|
|
|
#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
|
|
#endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */
|
|
@@ -3365,7 +3384,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
|
|
if (!size)
|
|
if (!size)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- set_pageblock_order(HUGETLB_PAGE_ORDER);
|
|
|
|
|
|
+ set_pageblock_order(pageblock_default_order());
|
|
setup_usemap(pgdat, zone, size);
|
|
setup_usemap(pgdat, zone, size);
|
|
ret = init_currently_empty_zone(zone, zone_start_pfn,
|
|
ret = init_currently_empty_zone(zone, zone_start_pfn,
|
|
size, MEMMAP_EARLY);
|
|
size, MEMMAP_EARLY);
|