diff options
author | Tejun Heo <tj@kernel.org> | 2011-07-14 03:46:10 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-07-14 14:45:29 -0400 |
commit | 5dfe8660a3d7f1ee1265c3536433ee53da3f98a3 (patch) | |
tree | c58232b88741ba1d8cce417b62f3f658369ad9c2 /arch/x86/mm | |
parent | fc769a8e70a3348d5de49e5f69f6aff810157360 (diff) |
bootmem: Replace work_with_active_regions() with for_each_mem_pfn_range()
Callback based iteration is cumbersome and much less useful than
for_each_*() iterator. This patch implements for_each_mem_pfn_range()
which replaces work_with_active_regions(). All the current users of
work_with_active_regions() are converted.
This simplifies walking over early_node_map and will allow converting
internal logics in page_alloc to use iterator instead of walking
early_node_map directly, which in turn will enable moving node
information to memblock.
powerpc change is only compile tested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/20110714074610.GD3455@htj.dyndns.org
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/memblock.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/arch/x86/mm/memblock.c b/arch/x86/mm/memblock.c index e126117d1b03..da0d5c84586e 100644 --- a/arch/x86/mm/memblock.c +++ b/arch/x86/mm/memblock.c | |||
@@ -115,28 +115,13 @@ static void __init memblock_x86_subtract_reserved(struct range *range, int az) | |||
115 | memblock_reserve_reserved_regions(); | 115 | memblock_reserve_reserved_regions(); |
116 | } | 116 | } |
117 | 117 | ||
118 | struct count_data { | ||
119 | int nr; | ||
120 | }; | ||
121 | |||
122 | static int __init count_work_fn(unsigned long start_pfn, | ||
123 | unsigned long end_pfn, void *datax) | ||
124 | { | ||
125 | struct count_data *data = datax; | ||
126 | |||
127 | data->nr++; | ||
128 | |||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | static int __init count_early_node_map(int nodeid) | 118 | static int __init count_early_node_map(int nodeid) |
133 | { | 119 | { |
134 | struct count_data data; | 120 | int i, cnt = 0; |
135 | |||
136 | data.nr = 0; | ||
137 | work_with_active_regions(nodeid, count_work_fn, &data); | ||
138 | 121 | ||
139 | return data.nr; | 122 | for_each_mem_pfn_range(i, nodeid, NULL, NULL, NULL) |
123 | cnt++; | ||
124 | return cnt; | ||
140 | } | 125 | } |
141 | 126 | ||
142 | int __init __get_free_all_memory_range(struct range **rangep, int nodeid, | 127 | int __init __get_free_all_memory_range(struct range **rangep, int nodeid, |