diff options
author | Tejun Heo <tj@kernel.org> | 2011-07-12 05:16:02 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-07-14 14:47:49 -0400 |
commit | 8a9ca34c11e1695dab7aff3cfa7780fbfe76b2f8 (patch) | |
tree | 5bd341215c7e829b89d1fcb481cfff71ef81f0f5 /mm | |
parent | 64a02daacbc880bac1d6b3aeefbcd226a9341fa7 (diff) |
memblock, x86: Replace __get_free_all_memory_range() with for_each_free_mem_range()
__get_free_all_memory_range() walks memblock, calculates free memory
areas and fills in the specified range. It can be easily replaced
with for_each_free_mem_range().
Convert free_low_memory_core_early() and
add_highpages_with_active_regions() to for_each_free_mem_range().
This leaves __get_free_all_memory_range() without any user. Kill it
and related functions.
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/1310462166-31469-10-git-send-email-tj@kernel.org
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/nobootmem.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 2037a8a04761..7075bc00fa84 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -108,21 +108,25 @@ static void __init __free_pages_memory(unsigned long start, unsigned long end) | |||
108 | 108 | ||
109 | unsigned long __init free_low_memory_core_early(int nodeid) | 109 | unsigned long __init free_low_memory_core_early(int nodeid) |
110 | { | 110 | { |
111 | int i; | ||
112 | u64 start, end; | ||
113 | unsigned long count = 0; | 111 | unsigned long count = 0; |
114 | struct range *range = NULL; | 112 | phys_addr_t start, end; |
115 | int nr_range; | 113 | u64 i; |
116 | 114 | ||
117 | nr_range = __get_free_all_memory_range(&range, nodeid, 0, max_low_pfn); | 115 | /* free reserved array temporarily so that it's treated as free area */ |
118 | 116 | memblock_free_reserved_regions(); | |
119 | for (i = 0; i < nr_range; i++) { | 117 | |
120 | start = range[i].start; | 118 | for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL) { |
121 | end = range[i].end; | 119 | unsigned long start_pfn = PFN_UP(start); |
122 | count += end - start; | 120 | unsigned long end_pfn = min_t(unsigned long, |
123 | __free_pages_memory(start, end); | 121 | PFN_DOWN(end), max_low_pfn); |
122 | if (start_pfn < end_pfn) { | ||
123 | __free_pages_memory(start_pfn, end_pfn); | ||
124 | count += end_pfn - start_pfn; | ||
125 | } | ||
124 | } | 126 | } |
125 | 127 | ||
128 | /* put region array back? */ | ||
129 | memblock_reserve_reserved_regions(); | ||
126 | return count; | 130 | return count; |
127 | } | 131 | } |
128 | 132 | ||