diff options
author | Mel Gorman <mel@csn.ul.ie> | 2007-10-16 04:26:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:00 -0400 |
commit | d9c2340052278d8eb2ffb16b0484f8f794def4de (patch) | |
tree | aec7e4e11473a4fcdfd389c718544780a042c6df /include/linux | |
parent | d100313fd615cc30374ff92e0b3facb053838330 (diff) |
Do not depend on MAX_ORDER when grouping pages by mobility
Currently mobility grouping works at the MAX_ORDER_NR_PAGES level. This makes
sense for the majority of users where this is also the huge page size.
However, on platforms like ia64 where the huge page size is runtime
configurable it is desirable to group at a lower order. On x86_64 and
occasionally on x86, the hugepage size may not always be MAX_ORDER_NR_PAGES.
This patch groups pages together based on the value of HUGETLB_PAGE_ORDER. It
uses a compile-time constant if possible and a variable where the huge page
size is runtime configurable.
It is assumed that grouping should be done at the lowest sensible order and
that the user would not want to override this. If this is not true,
page_block order could be forced to a variable initialised via a boot-time
kernel parameter.
One potential issue with this patch is that IA64 now parses hugepagesz with
early_param() instead of __setup(). __setup() is called after the memory
allocator has been initialised and the pageblock bitmaps already setup. In
tests on one IA64 there did not seem to be any problem with using
early_param() and in fact may be more correct as it guarantees the parameter
is handled before the parsing of hugepages=.
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Andy Whitcroft <apw@shadowen.org>
Acked-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/mmzone.h | 4 | ||||
-rw-r--r-- | include/linux/pageblock-flags.h | 25 |
2 files changed, 26 insertions, 3 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index fef08c6cf75..87a4045580f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -235,7 +235,7 @@ struct zone { | |||
235 | 235 | ||
236 | #ifndef CONFIG_SPARSEMEM | 236 | #ifndef CONFIG_SPARSEMEM |
237 | /* | 237 | /* |
238 | * Flags for a MAX_ORDER_NR_PAGES block. See pageblock-flags.h. | 238 | * Flags for a pageblock_nr_pages block. See pageblock-flags.h. |
239 | * In SPARSEMEM, this map is stored in struct mem_section | 239 | * In SPARSEMEM, this map is stored in struct mem_section |
240 | */ | 240 | */ |
241 | unsigned long *pageblock_flags; | 241 | unsigned long *pageblock_flags; |
@@ -740,7 +740,7 @@ extern struct zone *next_zone(struct zone *zone); | |||
740 | #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) | 740 | #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1)) |
741 | 741 | ||
742 | #define SECTION_BLOCKFLAGS_BITS \ | 742 | #define SECTION_BLOCKFLAGS_BITS \ |
743 | ((1 << (PFN_SECTION_SHIFT - (MAX_ORDER-1))) * NR_PAGEBLOCK_BITS) | 743 | ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS) |
744 | 744 | ||
745 | #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS | 745 | #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS |
746 | #error Allocator MAX_ORDER exceeds SECTION_SIZE | 746 | #error Allocator MAX_ORDER exceeds SECTION_SIZE |
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index 5456da6b4ad..9ea130829fb 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Macros for manipulating and testing flags related to a | 2 | * Macros for manipulating and testing flags related to a |
3 | * MAX_ORDER_NR_PAGES block of pages. | 3 | * pageblock_nr_pages number of pages. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -35,6 +35,29 @@ enum pageblock_bits { | |||
35 | NR_PAGEBLOCK_BITS | 35 | NR_PAGEBLOCK_BITS |
36 | }; | 36 | }; |
37 | 37 | ||
38 | #ifdef CONFIG_HUGETLB_PAGE | ||
39 | |||
40 | #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE | ||
41 | |||
42 | /* Huge page sizes are variable */ | ||
43 | extern int pageblock_order; | ||
44 | |||
45 | #else /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ | ||
46 | |||
47 | /* Huge pages are a constant size */ | ||
48 | #define pageblock_order HUGETLB_PAGE_ORDER | ||
49 | |||
50 | #endif /* CONFIG_HUGETLB_PAGE_SIZE_VARIABLE */ | ||
51 | |||
52 | #else /* CONFIG_HUGETLB_PAGE */ | ||
53 | |||
54 | /* If huge pages are not used, group by MAX_ORDER_NR_PAGES */ | ||
55 | #define pageblock_order (MAX_ORDER-1) | ||
56 | |||
57 | #endif /* CONFIG_HUGETLB_PAGE */ | ||
58 | |||
59 | #define pageblock_nr_pages (1UL << pageblock_order) | ||
60 | |||
38 | /* Forward declaration */ | 61 | /* Forward declaration */ |
39 | struct page; | 62 | struct page; |
40 | 63 | ||