提交 a2c54d2a 编写于 作者: R Russell King

ARM: memblock: use memblock when initializing memory allocators

Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 7dc50ec7
......@@ -192,11 +192,11 @@ static void __init arm_bootmem_init(struct meminfo *mi,
}
}
static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
unsigned long max_low, unsigned long max_high)
static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
unsigned long max_high)
{
unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
int i;
struct memblock_region *reg;
/*
* initialise the zones.
......@@ -218,13 +218,20 @@ static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
* holes = node_size - sum(bank_sizes)
*/
memcpy(zhole_size, zone_size, sizeof(zhole_size));
for_each_bank(i, mi) {
int idx = 0;
for_each_memblock(memory, reg) {
unsigned long start = memblock_region_memory_base_pfn(reg);
unsigned long end = memblock_region_memory_end_pfn(reg);
if (start < max_low) {
unsigned long low_end = min(end, max_low);
zhole_size[0] -= low_end - start;
}
#ifdef CONFIG_HIGHMEM
if (mi->bank[i].highmem)
idx = ZONE_HIGHMEM;
if (end > max_low) {
unsigned long high_start = max(start, max_low);
zhole_size[ZONE_HIGHMEM] -= end - high_start;
}
#endif
zhole_size[idx] -= bank_pfn_size(&mi->bank[i]);
}
/*
......@@ -327,7 +334,7 @@ void __init bootmem_init(void)
* the sparse mem_map arrays initialized by sparse_init()
* for memmap_init_zone(), otherwise all PFNs are invalid.
*/
arm_bootmem_free(mi, min, max_low, max_high);
arm_bootmem_free(min, max_low, max_high);
high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册