aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Capper <steve.capper@linaro.org>2013-05-30 14:32:50 +0100
committerSteve Capper <steve.capper@linaro.org>2013-06-03 16:13:18 +0100
commit00226e2acfd50c101c2d1f6141a0a16c256c8fea (patch)
tree8a2d3f1a4e0aa819bbb152787db8f9e11e270ce1
parente05f824ba1b68cda03b62d16ead66b8618245cb8 (diff)
downloadlinux-00226e2acfd50c101c2d1f6141a0a16c256c8fea.tar.gz
ARM: mm: Move over to arch-independent zone size init.
In arm the sizes of zones (and holes) are manually computed in arm_bootmem_free. The code to do this is already present in the arch indendent free_area_init_nodes function however. This patch enables HAVE_MEMBLOCK_NODE_MAP and hands over zone computation to free_area_init_nodes. This also allows for a simpler NUMA implementation were we may have zones straddling nodes. Signed-off-by: Steve Capper <steve.capper@linaro.org>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mm/init.c52
2 files changed, 10 insertions, 43 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 49d993cee51..ace7c08960b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -46,6 +46,7 @@ config ARM
select HAVE_KPROBES if !XIP_KERNEL
select HAVE_KRETPROBES if (HAVE_KPROBES)
select HAVE_MEMBLOCK
+ select HAVE_MEMBLOCK_NODE_MAP
select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
select HAVE_PERF_EVENTS
select HAVE_REGS_AND_STACK_ACCESS_API
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index f0e1bc0a723..b45f69ab1e5 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -264,56 +264,22 @@ void __init setup_dma_zone(struct machine_desc *mdesc)
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];
- struct memblock_region *reg;
-
- /*
- * initialise the zones.
- */
- memset(zone_size, 0, sizeof(zone_size));
+ unsigned long max_zone_pfns[MAX_NR_ZONES];
+ memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
+ max_zone_pfns[ZONE_NORMAL] = max_low;
- /*
- * The memory size has already been determined. If we need
- * to do anything fancy with the allocation of this memory
- * to the zones, now is the time to do it.
- */
- zone_size[0] = max_low - min;
#ifdef CONFIG_HIGHMEM
- zone_size[ZONE_HIGHMEM] = max_high - max_low;
+ max_zone_pfns[ZONE_HIGHMEM] = max_high;
#endif
- /*
- * Calculate the size of the holes.
- * holes = node_size - sum(bank_sizes)
- */
- memcpy(zhole_size, zone_size, sizeof(zhole_size));
- 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 (end > max_low) {
- unsigned long high_start = max(start, max_low);
- zhole_size[ZONE_HIGHMEM] -= end - high_start;
- }
-#endif
- }
-
#ifdef CONFIG_ZONE_DMA
- /*
- * Adjust the sizes according to any special requirements for
- * this machine type.
- */
- if (arm_dma_zone_size)
- arm_adjust_dma_zone(zone_size, zhole_size,
- arm_dma_zone_size >> PAGE_SHIFT);
+ max_zone_pfns[ZONE_DMA] = __phys_to_pfn(arm_dma_limit);
#endif
- free_area_init_node(0, zone_size, min, zhole_size);
+ memblock_set_node(__pfn_to_phys(min),
+ __pfn_to_phys(max_high - min), 0);
+
+ free_area_init_nodes(max_zone_pfns);
}
#ifdef CONFIG_HAVE_ARCH_PFN_VALID