diff options
author | Jiang Liu <liuj97@gmail.com> | 2013-07-03 18:03:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:07:35 -0400 |
commit | 2450c97323e635a04f7b2f4b68680ab2c151bbbf (patch) | |
tree | 10f77e2ed830fe2c0b37965745809b5541ac2059 /arch | |
parent | de35e1b828cb21d027265847ca32e5b9cff1c1e9 (diff) |
mm/ARM: prepare for removing num_physpages and simplify mem_init()
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mm/init.c | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 06e9ce17d1d2..6833cbead6cc 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -583,9 +583,6 @@ static void __init free_highpages(void) | |||
583 | */ | 583 | */ |
584 | void __init mem_init(void) | 584 | void __init mem_init(void) |
585 | { | 585 | { |
586 | unsigned long reserved_pages, free_pages; | ||
587 | struct memblock_region *reg; | ||
588 | int i; | ||
589 | #ifdef CONFIG_HAVE_TCM | 586 | #ifdef CONFIG_HAVE_TCM |
590 | /* These pointers are filled in on TCM detection */ | 587 | /* These pointers are filled in on TCM detection */ |
591 | extern u32 dtcm_end; | 588 | extern u32 dtcm_end; |
@@ -605,47 +602,7 @@ void __init mem_init(void) | |||
605 | 602 | ||
606 | free_highpages(); | 603 | free_highpages(); |
607 | 604 | ||
608 | reserved_pages = free_pages = 0; | 605 | mem_init_print_info(NULL); |
609 | |||
610 | for_each_bank(i, &meminfo) { | ||
611 | struct membank *bank = &meminfo.bank[i]; | ||
612 | unsigned int pfn1, pfn2; | ||
613 | struct page *page, *end; | ||
614 | |||
615 | pfn1 = bank_pfn_start(bank); | ||
616 | pfn2 = bank_pfn_end(bank); | ||
617 | |||
618 | page = pfn_to_page(pfn1); | ||
619 | end = pfn_to_page(pfn2 - 1) + 1; | ||
620 | |||
621 | do { | ||
622 | if (PageReserved(page)) | ||
623 | reserved_pages++; | ||
624 | else if (!page_count(page)) | ||
625 | free_pages++; | ||
626 | page++; | ||
627 | } while (page < end); | ||
628 | } | ||
629 | |||
630 | /* | ||
631 | * Since our memory may not be contiguous, calculate the | ||
632 | * real number of pages we have in this system | ||
633 | */ | ||
634 | printk(KERN_INFO "Memory:"); | ||
635 | num_physpages = 0; | ||
636 | for_each_memblock(memory, reg) { | ||
637 | unsigned long pages = memblock_region_memory_end_pfn(reg) - | ||
638 | memblock_region_memory_base_pfn(reg); | ||
639 | num_physpages += pages; | ||
640 | printk(" %ldMB", pages >> (20 - PAGE_SHIFT)); | ||
641 | } | ||
642 | printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); | ||
643 | |||
644 | printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n", | ||
645 | nr_free_pages() << (PAGE_SHIFT-10), | ||
646 | free_pages << (PAGE_SHIFT-10), | ||
647 | reserved_pages << (PAGE_SHIFT-10), | ||
648 | totalhigh_pages << (PAGE_SHIFT-10)); | ||
649 | 606 | ||
650 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 | 607 | #define MLK(b, t) b, t, ((t) - (b)) >> 10 |
651 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 | 608 | #define MLM(b, t) b, t, ((t) - (b)) >> 20 |
@@ -711,7 +668,7 @@ void __init mem_init(void) | |||
711 | BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); | 668 | BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET); |
712 | #endif | 669 | #endif |
713 | 670 | ||
714 | if (PAGE_SIZE >= 16384 && num_physpages <= 128) { | 671 | if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) { |
715 | extern int sysctl_overcommit_memory; | 672 | extern int sysctl_overcommit_memory; |
716 | /* | 673 | /* |
717 | * On a machine this small we won't get | 674 | * On a machine this small we won't get |