]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm/microblaze: prepare for removing num_physpages and simplify mem_init()
authorJiang Liu <liuj97@gmail.com>
Thu, 27 Jun 2013 23:51:58 +0000 (09:51 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:37:48 +0000 (16:37 +1000)
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>
arch/microblaze/mm/init.c

index b384cbc2c8f247023e5d7e14b11fe3c1ce689bde..6566e696eebbc2fcb49040937b26df64db9d0026 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(str);
 #ifdef CONFIG_MMU
        pr_info("Kernel virtual memory layout:\n");
        pr_info("  * 0x%08lx..0x%08lx  : fixmap\n", FIXADDR_START, FIXADDR_TOP);