diff options
author | Tang Chen <tangchen@cn.fujitsu.com> | 2013-02-22 19:33:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:14 -0500 |
commit | 42f47e27e761fee07da69e04612ec7dd0d490edd (patch) | |
tree | 15cab008a1759590cd50628b760ffc403f0f3dfc /mm/page_alloc.c | |
parent | 6981ec31146cf19454c55c130625f6cee89aab95 (diff) |
page_alloc: make movablemem_map have higher priority
If kernelcore or movablecore is specified at the same time with
movablemem_map, movablemem_map will have higher priority to be
satisfied. This patch will make find_zone_movable_pfns_for_nodes()
calculate zone_movable_pfn[] with the limit from zone_movable_limit[].
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Reviewed-by: Wen Congyang <wency@cn.fujitsu.com>
Cc: Wu Jianguo <wujianguo@huawei.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Tested-by: Lin Feng <linfeng@cn.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
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 | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0f267d9c73ff..88b9962c99b3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -4905,9 +4905,17 @@ static void __init find_zone_movable_pfns_for_nodes(void) | |||
4905 | required_kernelcore = max(required_kernelcore, corepages); | 4905 | required_kernelcore = max(required_kernelcore, corepages); |
4906 | } | 4906 | } |
4907 | 4907 | ||
4908 | /* If kernelcore was not specified, there is no ZONE_MOVABLE */ | 4908 | /* |
4909 | if (!required_kernelcore) | 4909 | * If neither kernelcore/movablecore nor movablemem_map is specified, |
4910 | * there is no ZONE_MOVABLE. But if movablemem_map is specified, the | ||
4911 | * start pfn of ZONE_MOVABLE has been stored in zone_movable_limit[]. | ||
4912 | */ | ||
4913 | if (!required_kernelcore) { | ||
4914 | if (movablemem_map.nr_map) | ||
4915 | memcpy(zone_movable_pfn, zone_movable_limit, | ||
4916 | sizeof(zone_movable_pfn)); | ||
4910 | goto out; | 4917 | goto out; |
4918 | } | ||
4911 | 4919 | ||
4912 | /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ | 4920 | /* usable_startpfn is the lowest possible pfn ZONE_MOVABLE can be at */ |
4913 | usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; | 4921 | usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; |
@@ -4937,10 +4945,24 @@ restart: | |||
4937 | for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { | 4945 | for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { |
4938 | unsigned long size_pages; | 4946 | unsigned long size_pages; |
4939 | 4947 | ||
4948 | /* | ||
4949 | * Find more memory for kernelcore in | ||
4950 | * [zone_movable_pfn[nid], zone_movable_limit[nid]). | ||
4951 | */ | ||
4940 | start_pfn = max(start_pfn, zone_movable_pfn[nid]); | 4952 | start_pfn = max(start_pfn, zone_movable_pfn[nid]); |
4941 | if (start_pfn >= end_pfn) | 4953 | if (start_pfn >= end_pfn) |
4942 | continue; | 4954 | continue; |
4943 | 4955 | ||
4956 | if (zone_movable_limit[nid]) { | ||
4957 | end_pfn = min(end_pfn, zone_movable_limit[nid]); | ||
4958 | /* No range left for kernelcore in this node */ | ||
4959 | if (start_pfn >= end_pfn) { | ||
4960 | zone_movable_pfn[nid] = | ||
4961 | zone_movable_limit[nid]; | ||
4962 | break; | ||
4963 | } | ||
4964 | } | ||
4965 | |||
4944 | /* Account for what is only usable for kernelcore */ | 4966 | /* Account for what is only usable for kernelcore */ |
4945 | if (start_pfn < usable_startpfn) { | 4967 | if (start_pfn < usable_startpfn) { |
4946 | unsigned long kernel_pages; | 4968 | unsigned long kernel_pages; |
@@ -5000,12 +5022,12 @@ restart: | |||
5000 | if (usable_nodes && required_kernelcore > usable_nodes) | 5022 | if (usable_nodes && required_kernelcore > usable_nodes) |
5001 | goto restart; | 5023 | goto restart; |
5002 | 5024 | ||
5025 | out: | ||
5003 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ | 5026 | /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */ |
5004 | for (nid = 0; nid < MAX_NUMNODES; nid++) | 5027 | for (nid = 0; nid < MAX_NUMNODES; nid++) |
5005 | zone_movable_pfn[nid] = | 5028 | zone_movable_pfn[nid] = |
5006 | roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES); | 5029 | roundup(zone_movable_pfn[nid], MAX_ORDER_NR_PAGES); |
5007 | 5030 | ||
5008 | out: | ||
5009 | /* restore the node_state */ | 5031 | /* restore the node_state */ |
5010 | node_states[N_MEMORY] = saved_node_state; | 5032 | node_states[N_MEMORY] = saved_node_state; |
5011 | } | 5033 | } |