diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2012-05-29 18:06:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-29 19:22:21 -0400 |
commit | 955c1cd7401565671b064e499115344ec8067dfd (patch) | |
tree | eee1370c654ac7d17403ca82a751e64a6ee041d9 /mm/page_alloc.c | |
parent | 2099597401c7710c00b0d7c32b24a44a193836e1 (diff) |
mm/page_alloc.c: remove pageblock_default_order()
This has always been broken: one version takes an unsigned int and the
other version takes no arguments. This bug was hidden because one
version of set_pageblock_order() was a macro which doesn't evaluate its
argument.
Simplify it all and remove pageblock_default_order() altogether.
Reported-by: rajman mekaco <rajman.mekaco@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8d71ad8ffa48..84f2c599d5d4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -4300,25 +4300,24 @@ static inline void setup_usemap(struct pglist_data *pgdat, | |||
4300 | 4300 | ||
4301 | #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE | 4301 | #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE |
4302 | 4302 | ||
4303 | /* Return a sensible default order for the pageblock size. */ | ||
4304 | static inline int pageblock_default_order(void) | ||
4305 | { | ||
4306 | if (HPAGE_SHIFT > PAGE_SHIFT) | ||
4307 | return HUGETLB_PAGE_ORDER; | ||
4308 | |||
4309 | return MAX_ORDER-1; | ||
4310 | } | ||
4311 | |||
4312 | /* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ | 4303 | /* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ |
4313 | static inline void __init set_pageblock_order(unsigned int order) | 4304 | static inline void __init set_pageblock_order(void) |
4314 | { | 4305 | { |
4306 | unsigned int order; | ||
4307 | |||
4315 | /* Check that pageblock_nr_pages has not already been setup */ | 4308 | /* Check that pageblock_nr_pages has not already been setup */ |
4316 | if (pageblock_order) | 4309 | if (pageblock_order) |
4317 | return; | 4310 | return; |
4318 | 4311 | ||
4312 | if (HPAGE_SHIFT > PAGE_SHIFT) | ||
4313 | order = HUGETLB_PAGE_ORDER; | ||
4314 | else | ||
4315 | order = MAX_ORDER - 1; | ||
4316 | |||
4319 | /* | 4317 | /* |
4320 | * Assume the largest contiguous order of interest is a huge page. | 4318 | * Assume the largest contiguous order of interest is a huge page. |
4321 | * This value may be variable depending on boot parameters on IA64 | 4319 | * This value may be variable depending on boot parameters on IA64 and |
4320 | * powerpc. | ||
4322 | */ | 4321 | */ |
4323 | pageblock_order = order; | 4322 | pageblock_order = order; |
4324 | } | 4323 | } |
@@ -4326,15 +4325,13 @@ static inline void __init set_pageblock_order(unsigned int order) | |||
4326 | 4325 | ||
4327 | /* | 4326 | /* |
4328 | * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order() | 4327 | * When CONFIG_HUGETLB_PAGE_SIZE_VARIABLE is not set, set_pageblock_order() |
4329 | * and pageblock_default_order() are unused as pageblock_order is set | 4328 | * is unused as pageblock_order is set at compile-time. See |
4330 | * at compile-time. See include/linux/pageblock-flags.h for the values of | 4329 | * include/linux/pageblock-flags.h for the values of pageblock_order based on |
4331 | * pageblock_order based on the kernel config | 4330 | * the kernel config |
4332 | */ | 4331 | */ |
4333 | static inline int pageblock_default_order(unsigned int order) | 4332 | static inline void set_pageblock_order(void) |
4334 | { | 4333 | { |
4335 | return MAX_ORDER-1; | ||
4336 | } | 4334 | } |
4337 | #define set_pageblock_order(x) do {} while (0) | ||
4338 | 4335 | ||
4339 | #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ | 4336 | #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ |
4340 | 4337 | ||
@@ -4422,7 +4419,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat, | |||
4422 | if (!size) | 4419 | if (!size) |
4423 | continue; | 4420 | continue; |
4424 | 4421 | ||
4425 | set_pageblock_order(pageblock_default_order()); | 4422 | set_pageblock_order(); |
4426 | setup_usemap(pgdat, zone, size); | 4423 | setup_usemap(pgdat, zone, size); |
4427 | ret = init_currently_empty_zone(zone, zone_start_pfn, | 4424 | ret = init_currently_empty_zone(zone, zone_start_pfn, |
4428 | size, MEMMAP_EARLY); | 4425 | size, MEMMAP_EARLY); |