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

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm64/mm/init.c

index 93de98afedd77494b3ed499302ae9f16172c2a6a..b16c778ea0dea4c32cca0a4beeca98d7a5d65326 100644 (file)
@@ -272,59 +272,17 @@ static void __init free_unused_memmap(void)
  */
 void __init mem_init(void)
 {
-       unsigned long reserved_pages, free_pages;
-       struct memblock_region *reg;
-
        arm64_swiotlb_init();
 
        max_mapnr   = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
 
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
-       /* this will put all unused low memory onto the freelists */
        free_unused_memmap();
 #endif
-
+       /* this will put all unused low memory onto the freelists */
        free_all_bootmem();
 
-       reserved_pages = free_pages = 0;
-
-       for_each_memblock(memory, reg) {
-               unsigned int pfn1, pfn2;
-               struct page *page, *end;
-
-               pfn1 = __phys_to_pfn(reg->base);
-               pfn2 = pfn1 + __phys_to_pfn(reg->size);
-
-               page = pfn_to_page(pfn1);
-               end  = pfn_to_page(pfn2 - 1) + 1;
-
-               do {
-                       if (PageReserved(page))
-                               reserved_pages++;
-                       else if (!page_count(page))
-                               free_pages++;
-                       page++;
-               } while (page < end);
-       }
-
-       /*
-        * Since our memory may not be contiguous, calculate the real number
-        * of pages we have in this system.
-        */
-       pr_info("Memory:");
-       num_physpages = 0;
-       for_each_memblock(memory, reg) {
-               unsigned long pages = memblock_region_memory_end_pfn(reg) -
-                       memblock_region_memory_base_pfn(reg);
-               num_physpages += pages;
-               printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
-       }
-       printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
-
-       pr_notice("Memory: %luk/%luk available, %luk reserved\n",
-                 nr_free_pages() << (PAGE_SHIFT-10),
-                 free_pages << (PAGE_SHIFT-10),
-                 reserved_pages << (PAGE_SHIFT-10));
+       mem_init_print_info();
 
 #define MLK(b, t) b, t, ((t) - (b)) >> 10
 #define MLM(b, t) b, t, ((t) - (b)) >> 20
@@ -366,7 +324,7 @@ void __init mem_init(void)
        BUILD_BUG_ON(TASK_SIZE_64                       > MODULES_VADDR);
        BUG_ON(TASK_SIZE_64                             > MODULES_VADDR);
 
-       if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
+       if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
                extern int sysctl_overcommit_memory;
                /*
                 * On a machine this small we won't get anywhere without