diff options
author | Pekka Enberg <penberg@kernel.org> | 2011-11-01 09:58:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-11-11 04:22:55 -0500 |
commit | 176239153049a023d060ce95b05f7ef31667e362 (patch) | |
tree | fce64421a695752fc9dfa9fa2331c11f95083146 /arch | |
parent | 248b52b97da7a712d2263a51d8d84c959f38ef75 (diff) |
x86, mm: Unify zone_sizes_init()
Now that zone_sizes_init() is identical on 32-bit and 64-bit,
move the code to arch/x86/mm/init.c and use it for both
architectures.
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Link: http://lkml.kernel.org/r/1320155902-10424-7-git-send-email-penberg@kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/init.h | 2 | ||||
-rw-r--r-- | arch/x86/mm/init.c | 23 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 19 | ||||
-rw-r--r-- | arch/x86/mm/init_64.c | 19 |
4 files changed, 25 insertions, 38 deletions
diff --git a/arch/x86/include/asm/init.h b/arch/x86/include/asm/init.h index 8dbe353e41e1..adcc0ae73d09 100644 --- a/arch/x86/include/asm/init.h +++ b/arch/x86/include/asm/init.h | |||
@@ -5,6 +5,8 @@ | |||
5 | extern void __init early_ioremap_page_table_range_init(void); | 5 | extern void __init early_ioremap_page_table_range_init(void); |
6 | #endif | 6 | #endif |
7 | 7 | ||
8 | extern void __init zone_sizes_init(void); | ||
9 | |||
8 | extern unsigned long __init | 10 | extern unsigned long __init |
9 | kernel_physical_mapping_init(unsigned long start, | 11 | kernel_physical_mapping_init(unsigned long start, |
10 | unsigned long end, | 12 | unsigned long end, |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 87488b93a65c..2426b60bb409 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/ioport.h> | 3 | #include <linux/ioport.h> |
4 | #include <linux/swap.h> | 4 | #include <linux/swap.h> |
5 | #include <linux/memblock.h> | 5 | #include <linux/memblock.h> |
6 | #include <linux/bootmem.h> /* for max_low_pfn */ | ||
6 | 7 | ||
7 | #include <asm/cacheflush.h> | 8 | #include <asm/cacheflush.h> |
8 | #include <asm/e820.h> | 9 | #include <asm/e820.h> |
@@ -15,6 +16,7 @@ | |||
15 | #include <asm/tlbflush.h> | 16 | #include <asm/tlbflush.h> |
16 | #include <asm/tlb.h> | 17 | #include <asm/tlb.h> |
17 | #include <asm/proto.h> | 18 | #include <asm/proto.h> |
19 | #include <asm/dma.h> /* for MAX_DMA_PFN */ | ||
18 | 20 | ||
19 | unsigned long __initdata pgt_buf_start; | 21 | unsigned long __initdata pgt_buf_start; |
20 | unsigned long __meminitdata pgt_buf_end; | 22 | unsigned long __meminitdata pgt_buf_end; |
@@ -392,3 +394,24 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
392 | free_init_pages("initrd memory", start, PAGE_ALIGN(end)); | 394 | free_init_pages("initrd memory", start, PAGE_ALIGN(end)); |
393 | } | 395 | } |
394 | #endif | 396 | #endif |
397 | |||
398 | void __init zone_sizes_init(void) | ||
399 | { | ||
400 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
401 | |||
402 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
403 | |||
404 | #ifdef CONFIG_ZONE_DMA | ||
405 | max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; | ||
406 | #endif | ||
407 | #ifdef CONFIG_ZONE_DMA32 | ||
408 | max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; | ||
409 | #endif | ||
410 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | ||
411 | #ifdef CONFIG_HIGHMEM | ||
412 | max_zone_pfns[ZONE_HIGHMEM] = max_pfn; | ||
413 | #endif | ||
414 | |||
415 | free_area_init_nodes(max_zone_pfns); | ||
416 | } | ||
417 | |||
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 27455b958b8d..3bebaed5021c 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -674,25 +674,6 @@ void __init initmem_init(void) | |||
674 | } | 674 | } |
675 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | 675 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ |
676 | 676 | ||
677 | static void __init zone_sizes_init(void) | ||
678 | { | ||
679 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
680 | |||
681 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
682 | #ifdef CONFIG_ZONE_DMA | ||
683 | max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; | ||
684 | #endif | ||
685 | #ifdef CONFIG_ZONE_DMA32 | ||
686 | max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; | ||
687 | #endif | ||
688 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | ||
689 | #ifdef CONFIG_HIGHMEM | ||
690 | max_zone_pfns[ZONE_HIGHMEM] = max_pfn; | ||
691 | #endif | ||
692 | |||
693 | free_area_init_nodes(max_zone_pfns); | ||
694 | } | ||
695 | |||
696 | void __init setup_bootmem_allocator(void) | 677 | void __init setup_bootmem_allocator(void) |
697 | { | 678 | { |
698 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", | 679 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 06c4360cf796..6fcce7d34555 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -612,25 +612,6 @@ void __init initmem_init(void) | |||
612 | } | 612 | } |
613 | #endif | 613 | #endif |
614 | 614 | ||
615 | static void __init zone_sizes_init(void) | ||
616 | { | ||
617 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
618 | |||
619 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
620 | #ifdef CONFIG_ZONE_DMA | ||
621 | max_zone_pfns[ZONE_DMA] = MAX_DMA_PFN; | ||
622 | #endif | ||
623 | #ifdef CONFIG_ZONE_DMA32 | ||
624 | max_zone_pfns[ZONE_DMA32] = MAX_DMA32_PFN; | ||
625 | #endif | ||
626 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | ||
627 | #ifdef CONFIG_HIGHMEM | ||
628 | max_zone_pfns[ZONE_HIGHMEM] = max_pfn; | ||
629 | #endif | ||
630 | |||
631 | free_area_init_nodes(max_zone_pfns); | ||
632 | } | ||
633 | |||
634 | void __init paging_init(void) | 615 | void __init paging_init(void) |
635 | { | 616 | { |
636 | sparse_memory_present_with_active_regions(MAX_NUMNODES); | 617 | sparse_memory_present_with_active_regions(MAX_NUMNODES); |