aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-07-03 18:04:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:38 -0400
commit46a841329a6cd6298e131afd82e7d58130b19025 (patch)
tree79daedf13a8623ae34d84d554fb003b906a182fe /arch/x86/mm
parent0d0b6d26ad52093452b1228325a99244e925582a (diff)
mm/x86: prepare for removing num_physpages and simplify mem_init()
Prepare for removing num_physpages and simplify mem_init(). Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andreas Herrmann <andreas.herrmann3@amd.com> Cc: Tang Chen <tangchen@cn.fujitsu.com> Cc: Wen Congyang <wency@cn.fujitsu.com> Cc: Jianguo Wu <wujianguo@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r--arch/x86/mm/init_32.c30
-rw-r--r--arch/x86/mm/init_64.c20
-rw-r--r--arch/x86/mm/numa_32.c2
3 files changed, 3 insertions, 49 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 9fa46baada27..4287f1ffba7e 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -660,10 +660,8 @@ void __init initmem_init(void)
660 highstart_pfn = max_low_pfn; 660 highstart_pfn = max_low_pfn;
661 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 661 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
662 pages_to_mb(highend_pfn - highstart_pfn)); 662 pages_to_mb(highend_pfn - highstart_pfn));
663 num_physpages = highend_pfn;
664 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 663 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
665#else 664#else
666 num_physpages = max_low_pfn;
667 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 665 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
668#endif 666#endif
669 667
@@ -671,7 +669,7 @@ void __init initmem_init(void)
671 sparse_memory_present_with_active_regions(0); 669 sparse_memory_present_with_active_regions(0);
672 670
673#ifdef CONFIG_FLATMEM 671#ifdef CONFIG_FLATMEM
674 max_mapnr = num_physpages; 672 max_mapnr = IS_ENABLED(CONFIG_HIGHMEM) ? highend_pfn : max_low_pfn;
675#endif 673#endif
676 __vmalloc_start_set = true; 674 __vmalloc_start_set = true;
677 675
@@ -739,9 +737,6 @@ static void __init test_wp_bit(void)
739 737
740void __init mem_init(void) 738void __init mem_init(void)
741{ 739{
742 int codesize, reservedpages, datasize, initsize;
743 int tmp;
744
745 pci_iommu_alloc(); 740 pci_iommu_alloc();
746 741
747#ifdef CONFIG_FLATMEM 742#ifdef CONFIG_FLATMEM
@@ -761,30 +756,9 @@ void __init mem_init(void)
761 /* this will put all low memory onto the freelists */ 756 /* this will put all low memory onto the freelists */
762 free_all_bootmem(); 757 free_all_bootmem();
763 758
764 reservedpages = 0;
765 for (tmp = 0; tmp < max_low_pfn; tmp++)
766 /*
767 * Only count reserved RAM pages:
768 */
769 if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
770 reservedpages++;
771
772 after_bootmem = 1; 759 after_bootmem = 1;
773 760
774 codesize = (unsigned long) &_etext - (unsigned long) &_text; 761 mem_init_print_info(NULL);
775 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
776 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
777
778 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
779 "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
780 nr_free_pages() << (PAGE_SHIFT-10),
781 num_physpages << (PAGE_SHIFT-10),
782 codesize >> 10,
783 reservedpages << (PAGE_SHIFT-10),
784 datasize >> 10,
785 initsize >> 10,
786 totalhigh_pages << (PAGE_SHIFT-10));
787
788 printk(KERN_INFO "virtual kernel memory layout:\n" 762 printk(KERN_INFO "virtual kernel memory layout:\n"
789 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 763 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
790#ifdef CONFIG_HIGHMEM 764#ifdef CONFIG_HIGHMEM
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 9577638f3ead..104d56a9245f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1044,9 +1044,6 @@ static void __init register_page_bootmem_info(void)
1044 1044
1045void __init mem_init(void) 1045void __init mem_init(void)
1046{ 1046{
1047 long codesize, reservedpages, datasize, initsize;
1048 unsigned long absent_pages;
1049
1050 pci_iommu_alloc(); 1047 pci_iommu_alloc();
1051 1048
1052 /* clear_bss() already clear the empty_zero_page */ 1049 /* clear_bss() already clear the empty_zero_page */
@@ -1055,28 +1052,13 @@ void __init mem_init(void)
1055 1052
1056 /* this will put all memory onto the freelists */ 1053 /* this will put all memory onto the freelists */
1057 free_all_bootmem(); 1054 free_all_bootmem();
1058
1059 absent_pages = absent_pages_in_range(0, max_pfn);
1060 reservedpages = max_pfn - totalram_pages - absent_pages;
1061 after_bootmem = 1; 1055 after_bootmem = 1;
1062 1056
1063 codesize = (unsigned long) &_etext - (unsigned long) &_text;
1064 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
1065 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
1066
1067 /* Register memory areas for /proc/kcore */ 1057 /* Register memory areas for /proc/kcore */
1068 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 1058 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
1069 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER); 1059 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
1070 1060
1071 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 1061 mem_init_print_info(NULL);
1072 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
1073 nr_free_pages() << (PAGE_SHIFT-10),
1074 max_pfn << (PAGE_SHIFT-10),
1075 codesize >> 10,
1076 absent_pages << (PAGE_SHIFT-10),
1077 reservedpages << (PAGE_SHIFT-10),
1078 datasize >> 10,
1079 initsize >> 10);
1080} 1062}
1081 1063
1082#ifdef CONFIG_DEBUG_RODATA 1064#ifdef CONFIG_DEBUG_RODATA
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 73a6d7395bd3..0342d27ca798 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -83,10 +83,8 @@ void __init initmem_init(void)
83 highstart_pfn = max_low_pfn; 83 highstart_pfn = max_low_pfn;
84 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", 84 printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
85 pages_to_mb(highend_pfn - highstart_pfn)); 85 pages_to_mb(highend_pfn - highstart_pfn));
86 num_physpages = highend_pfn;
87 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; 86 high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
88#else 87#else
89 num_physpages = max_low_pfn;
90 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; 88 high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
91#endif 89#endif
92 printk(KERN_NOTICE "%ldMB LOWMEM available.\n", 90 printk(KERN_NOTICE "%ldMB LOWMEM available.\n",