]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
mm/ppc: prepare for removing num_physpages and simplify mem_init()
authorJiang Liu <liuj97@gmail.com>
Wed, 3 Jul 2013 22:04:09 +0000 (15:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 3 Jul 2013 23:07:37 +0000 (16:07 -0700)
Prepare for removing num_physpages and simplify mem_init().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/powerpc/mm/mem.c

index 3bcfc0d0d3227a3ac2b3970cf3437c1eb491d9d4..49c18b60bbb41cd210fd0e0c48cfb81d7dc76e5f 100644 (file)
@@ -299,46 +299,27 @@ void __init paging_init(void)
 
 void __init mem_init(void)
 {
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-       int nid;
-#endif
-       pg_data_t *pgdat;
-       unsigned long i;
-       struct page *page;
-       unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
-
 #ifdef CONFIG_SWIOTLB
        swiotlb_init(0);
 #endif
 
-       num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
        high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
 
 #ifdef CONFIG_NEED_MULTIPLE_NODES
-        for_each_online_node(nid) {
-               if (NODE_DATA(nid)->node_spanned_pages != 0) {
-                       printk("freeing bootmem node %d\n", nid);
-                       free_all_bootmem_node(NODE_DATA(nid));
-               }
+       {
+               pg_data_t *pgdat;
+
+               for_each_online_pgdat(pgdat)
+                       if (pgdat->node_spanned_pages != 0) {
+                               printk("freeing bootmem node %d\n",
+                                       pgdat->node_id);
+                               free_all_bootmem_node(pgdat);
+                       }
        }
 #else
        max_mapnr = max_pfn;
        free_all_bootmem();
 #endif
-       for_each_online_pgdat(pgdat) {
-               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++;
-               }
-       }
-
-       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;
 
 #ifdef CONFIG_HIGHMEM
        {
@@ -348,13 +329,9 @@ void __init mem_init(void)
                for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
                        phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT;
                        struct page *page = pfn_to_page(pfn);
-                       if (memblock_is_reserved(paddr))
-                               continue;
-                       free_highmem_page(page);
-                       reservedpages--;
+                       if (!memblock_is_reserved(paddr))
+                               free_highmem_page(page);
                }
-               printk(KERN_DEBUG "High memory: %luk\n",
-                      totalhigh_pages << (PAGE_SHIFT-10));
        }
 #endif /* CONFIG_HIGHMEM */
 
@@ -367,16 +344,7 @@ void __init mem_init(void)
                (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1;
 #endif
 
-       printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, "
-              "%luk reserved, %luk data, %luk bss, %luk init)\n",
-               nr_free_pages() << (PAGE_SHIFT-10),
-               num_physpages << (PAGE_SHIFT-10),
-               codesize >> 10,
-               reservedpages << (PAGE_SHIFT-10),
-               datasize >> 10,
-               bsssize >> 10,
-               initsize >> 10);
-
+       mem_init_print_info(NULL);
 #ifdef CONFIG_PPC32
        pr_info("Kernel virtual memory layout:\n");
        pr_info("  * 0x%08lx..0x%08lx  : fixmap\n", FIXADDR_START, FIXADDR_TOP);