diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-27 19:45:49 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-10-28 13:54:44 +0100 |
commit | df4f14c7b22e43e67c0e4e3b005ff897a0a72f4d (patch) | |
tree | 1e4bc4f02854bb7e6559301fd79031747ba3c2b0 | |
parent | d0e775afb94d9b61ba6c63299169ef7a87b68189 (diff) | |
download | kernel_samsung_aries-df4f14c7b22e43e67c0e4e3b005ff897a0a72f4d.zip kernel_samsung_aries-df4f14c7b22e43e67c0e4e3b005ff897a0a72f4d.tar.gz kernel_samsung_aries-df4f14c7b22e43e67c0e4e3b005ff897a0a72f4d.tar.bz2 |
ARM: memblock: convert free_highpages() to use memblock
Free the high pages using the memblock memory lists - and more
importantly, exclude any memblock allocations in highmem from the
free'd memory.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mm/init.c | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 1b4e0ab..5422821 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -439,13 +439,47 @@ static void __init free_unused_memmap(struct meminfo *mi) static void __init free_highpages(void) { #ifdef CONFIG_HIGHMEM - int i; + unsigned long max_low = max_low_pfn + PHYS_PFN_OFFSET; + struct memblock_region *mem, *res; /* set highmem page free */ - for_each_bank (i, &meminfo) { - unsigned long start = bank_pfn_start(&meminfo.bank[i]); - unsigned long end = bank_pfn_end(&meminfo.bank[i]); - if (start >= max_low_pfn + PHYS_PFN_OFFSET) + for_each_memblock(memory, mem) { + unsigned long start = memblock_region_memory_base_pfn(mem); + unsigned long end = memblock_region_memory_end_pfn(mem); + + /* Ignore complete lowmem entries */ + if (end <= max_low) + continue; + + /* Truncate partial highmem entries */ + if (start < max_low) + start = max_low; + + /* Find and exclude any reserved regions */ + for_each_memblock(reserved, res) { + unsigned long res_start, res_end; + + res_start = memblock_region_reserved_base_pfn(res); + res_end = memblock_region_reserved_end_pfn(res); + + if (res_end < start) + continue; + if (res_start < start) + res_start = start; + if (res_start > end) + res_start = end; + if (res_end > end) + res_end = end; + if (res_start != start) + totalhigh_pages += free_area(start, res_start, + NULL); + start = res_end; + if (start == end) + break; + } + + /* And now free anything which remains */ + if (start < end) totalhigh_pages += free_area(start, end, NULL); } totalram_pages += totalhigh_pages; |