mm/microblaze: prepare for removing num_physpages and simplify mem_init()
authorJiang Liu <liuj97@gmail.com>
Wed, 3 Jul 2013 22:04:02 +0000 (15:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:07:36 +0000 (16:07 -0700)
Prepare for removing num_physpages and simplify mem_init().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm64/mm/init.c
arch/microblaze/mm/init.c

index b16c778ea0dea4c32cca0a4beeca98d7a5d65326..67e8d7ce3fe7a68ac1c974058de83b8d6226086e 100644 (file)
@@ -282,7 +282,7 @@ void __init mem_init(void)
        /* this will put all unused low memory onto the freelists */
        free_all_bootmem();
 
-       mem_init_print_info();
+       mem_init_print_info(NULL);
 
 #define MLK(b, t) b, t, ((t) - (b)) >> 10
 #define MLM(b, t) b, t, ((t) - (b)) >> 20
index b384cbc2c8f247023e5d7e14b11fe3c1ce689bde..74c7bcc1e82d8da05b6775274f572fe17114d5f0 100644 (file)
@@ -71,24 +71,17 @@ static void __init highmem_init(void)
        kmap_prot = PAGE_KERNEL;
 }
 
-static unsigned long highmem_setup(void)
+static void highmem_setup(void)
 {
        unsigned long pfn;
-       unsigned long reservedpages = 0;
 
        for (pfn = max_low_pfn; pfn < max_pfn; ++pfn) {
                struct page *page = pfn_to_page(pfn);
 
                /* FIXME not sure about */
-               if (memblock_is_reserved(pfn << PAGE_SHIFT))
-                       continue;
-               free_highmem_page(page);
-               reservedpages++;
+               if (!memblock_is_reserved(pfn << PAGE_SHIFT))
+                       free_highmem_page(page);
        }
-       pr_info("High memory: %luk\n",
-                                       totalhigh_pages << (PAGE_SHIFT-10));
-
-       return reservedpages;
 }
 #endif /* CONFIG_HIGHMEM */
 
@@ -167,13 +160,12 @@ void __init setup_memory(void)
         * min_low_pfn - the first page (mm/bootmem.c - node_boot_start)
         * max_low_pfn
         * max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn)
-        * num_physpages - number of all pages
         */
 
        /* memory start is from the kernel end (aligned) to higher addr */
        min_low_pfn = memory_start >> PAGE_SHIFT; /* minimum for allocation */
        /* RAM is assumed contiguous */
-       num_physpages = max_mapnr = memory_size >> PAGE_SHIFT;
+       max_mapnr = memory_size >> PAGE_SHIFT;
        max_low_pfn = ((u64)memory_start + (u64)lowmem_size) >> PAGE_SHIFT;
        max_pfn = ((u64)memory_start + (u64)memory_size) >> PAGE_SHIFT;
 
@@ -246,46 +238,15 @@ void free_initmem(void)
 
 void __init mem_init(void)
 {
-       pg_data_t *pgdat;
-       unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
-
        high_memory = (void *)__va(memory_start + lowmem_size - 1);
 
        /* this will put all memory onto the freelists */
        free_all_bootmem();
-
-       for_each_online_pgdat(pgdat) {
-               unsigned long i;
-               struct page *page;
-
-               for (i = 0; i < pgdat->node_spanned_pages; i++) {
-                       if (!pfn_valid(pgdat->node_start_pfn + i))
-                               continue;
-                       page = pgdat_page_nr(pgdat, i);
-                       if (PageReserved(page))
-                               reservedpages++;
-               }
-       }
-
 #ifdef CONFIG_HIGHMEM
-       reservedpages -= highmem_setup();
+       highmem_setup();
 #endif
 
-       codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
-       datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
-       initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
-       bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
-
-       pr_info("Memory: %luk/%luk available (%luk kernel code, ",
-               nr_free_pages() << (PAGE_SHIFT-10),
-               num_physpages << (PAGE_SHIFT-10),
-               codesize >> 10);
-       pr_cont("%luk reserved, %luk data, %luk bss, %luk init)\n",
-               reservedpages << (PAGE_SHIFT-10),
-               datasize >> 10,
-               bsssize >> 10,
-               initsize >> 10);
-
+       mem_init_print_info(NULL);
 #ifdef CONFIG_MMU
        pr_info("Kernel virtual memory layout:\n");
        pr_info("  * 0x%08lx..0x%08lx  : fixmap\n", FIXADDR_START, FIXADDR_TOP);