]> Pileus Git - ~andy/linux/commitdiff
mm/x86: prepare for removing num_physpages and simplify mem_init()
authorJiang Liu <liuj97@gmail.com>
Wed, 3 Jul 2013 22:04:19 +0000 (15:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:07:38 +0000 (16:07 -0700)
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>
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/setup.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/numa_32.c

index 5013a48d1aff7a2f859a4d2e28224d1da4d95ea4..c587a8757227b2b5297e1d5607218a2d96802608 100644 (file)
@@ -90,7 +90,7 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
 static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
 {
        u32 l, h;
-       int mbytes = num_physpages >> (20-PAGE_SHIFT);
+       int mbytes = get_num_physpages() >> (20-PAGE_SHIFT);
 
        if (c->x86_model < 6) {
                /* Based on AMD doc 20734R - June 2000 */
index 56f7fcfe7fa268d558b6032fdc52643add1d1232..e68709da8251b4b7b559e4d73b8db05cdff0d47d 100644 (file)
@@ -1040,8 +1040,6 @@ void __init setup_arch(char **cmdline_p)
        /* max_low_pfn get updated here */
        find_low_pfn_range();
 #else
-       num_physpages = max_pfn;
-
        check_x2apic();
 
        /* How many end-of-memory variables you have, grandma! */
index 9fa46baada27e33972757c27e15e4cf196d373db..4287f1ffba7ef2e42cc68839a38c3ecc0d6b1304 100644 (file)
@@ -660,10 +660,8 @@ void __init initmem_init(void)
                highstart_pfn = max_low_pfn;
        printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
                pages_to_mb(highend_pfn - highstart_pfn));
-       num_physpages = highend_pfn;
        high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
 #else
-       num_physpages = max_low_pfn;
        high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif
 
@@ -671,7 +669,7 @@ void __init initmem_init(void)
        sparse_memory_present_with_active_regions(0);
 
 #ifdef CONFIG_FLATMEM
-       max_mapnr = num_physpages;
+       max_mapnr = IS_ENABLED(CONFIG_HIGHMEM) ? highend_pfn : max_low_pfn;
 #endif
        __vmalloc_start_set = true;
 
@@ -739,9 +737,6 @@ static void __init test_wp_bit(void)
 
 void __init mem_init(void)
 {
-       int codesize, reservedpages, datasize, initsize;
-       int tmp;
-
        pci_iommu_alloc();
 
 #ifdef CONFIG_FLATMEM
@@ -761,30 +756,9 @@ void __init mem_init(void)
        /* this will put all low memory onto the freelists */
        free_all_bootmem();
 
-       reservedpages = 0;
-       for (tmp = 0; tmp < max_low_pfn; tmp++)
-               /*
-                * Only count reserved RAM pages:
-                */
-               if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
-                       reservedpages++;
-
        after_bootmem = 1;
 
-       codesize =  (unsigned long) &_etext - (unsigned long) &_text;
-       datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
-       initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
-       printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
-                       "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
-               nr_free_pages() << (PAGE_SHIFT-10),
-               num_physpages << (PAGE_SHIFT-10),
-               codesize >> 10,
-               reservedpages << (PAGE_SHIFT-10),
-               datasize >> 10,
-               initsize >> 10,
-               totalhigh_pages << (PAGE_SHIFT-10));
-
+       mem_init_print_info(NULL);
        printk(KERN_INFO "virtual kernel memory layout:\n"
                "    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 #ifdef CONFIG_HIGHMEM
index 9577638f3ead4714d6afc4143474f1661c06cd70..104d56a9245f1ea071009dc49e3bd25a2c48383b 100644 (file)
@@ -1044,9 +1044,6 @@ static void __init register_page_bootmem_info(void)
 
 void __init mem_init(void)
 {
-       long codesize, reservedpages, datasize, initsize;
-       unsigned long absent_pages;
-
        pci_iommu_alloc();
 
        /* clear_bss() already clear the empty_zero_page */
@@ -1055,28 +1052,13 @@ void __init mem_init(void)
 
        /* this will put all memory onto the freelists */
        free_all_bootmem();
-
-       absent_pages = absent_pages_in_range(0, max_pfn);
-       reservedpages = max_pfn - totalram_pages - absent_pages;
        after_bootmem = 1;
 
-       codesize =  (unsigned long) &_etext - (unsigned long) &_text;
-       datasize =  (unsigned long) &_edata - (unsigned long) &_etext;
-       initsize =  (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
        /* Register memory areas for /proc/kcore */
        kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
                         VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
 
-       printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
-                        "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
-               nr_free_pages() << (PAGE_SHIFT-10),
-               max_pfn << (PAGE_SHIFT-10),
-               codesize >> 10,
-               absent_pages << (PAGE_SHIFT-10),
-               reservedpages << (PAGE_SHIFT-10),
-               datasize >> 10,
-               initsize >> 10);
+       mem_init_print_info(NULL);
 }
 
 #ifdef CONFIG_DEBUG_RODATA
index 73a6d7395bd355630d6d00abf5c9d4730fd83766..0342d27ca7986924d9ed8c68f21a88bec982ed89 100644 (file)
@@ -83,10 +83,8 @@ void __init initmem_init(void)
                highstart_pfn = max_low_pfn;
        printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
               pages_to_mb(highend_pfn - highstart_pfn));
-       num_physpages = highend_pfn;
        high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
 #else
-       num_physpages = max_low_pfn;
        high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif
        printk(KERN_NOTICE "%ldMB LOWMEM available.\n",