aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-10-27 14:17:31 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-10-28 08:54:42 -0400
commita2c54d2af848fafd53f0314947d0741313205dbc (patch)
tree5b558fd44ceff26aa28e7cae58ee5a317eb522ee /arch/arm/mm
parent7dc50ec7283391dd7a29a80e2a0fb76731a6a7c7 (diff)
ARM: memblock: use memblock when initializing memory allocators
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/init.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 759878355a05..f68c93bb1fde 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -192,11 +192,11 @@ static void __init arm_bootmem_init(struct meminfo *mi,
192 } 192 }
193} 193}
194 194
195static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min, 195static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
196 unsigned long max_low, unsigned long max_high) 196 unsigned long max_high)
197{ 197{
198 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 198 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
199 int i; 199 struct memblock_region *reg;
200 200
201 /* 201 /*
202 * initialise the zones. 202 * initialise the zones.
@@ -218,13 +218,20 @@ static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
218 * holes = node_size - sum(bank_sizes) 218 * holes = node_size - sum(bank_sizes)
219 */ 219 */
220 memcpy(zhole_size, zone_size, sizeof(zhole_size)); 220 memcpy(zhole_size, zone_size, sizeof(zhole_size));
221 for_each_bank(i, mi) { 221 for_each_memblock(memory, reg) {
222 int idx = 0; 222 unsigned long start = memblock_region_memory_base_pfn(reg);
223 unsigned long end = memblock_region_memory_end_pfn(reg);
224
225 if (start < max_low) {
226 unsigned long low_end = min(end, max_low);
227 zhole_size[0] -= low_end - start;
228 }
223#ifdef CONFIG_HIGHMEM 229#ifdef CONFIG_HIGHMEM
224 if (mi->bank[i].highmem) 230 if (end > max_low) {
225 idx = ZONE_HIGHMEM; 231 unsigned long high_start = max(start, max_low);
232 zhole_size[ZONE_HIGHMEM] -= end - high_start;
233 }
226#endif 234#endif
227 zhole_size[idx] -= bank_pfn_size(&mi->bank[i]);
228 } 235 }
229 236
230 /* 237 /*
@@ -327,7 +334,7 @@ void __init bootmem_init(void)
327 * the sparse mem_map arrays initialized by sparse_init() 334 * the sparse mem_map arrays initialized by sparse_init()
328 * for memmap_init_zone(), otherwise all PFNs are invalid. 335 * for memmap_init_zone(), otherwise all PFNs are invalid.
329 */ 336 */
330 arm_bootmem_free(mi, min, max_low, max_high); 337 arm_bootmem_free(min, max_low, max_high);
331 338
332 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; 339 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
333 340