aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/init_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/mm/init_64.c')
-rw-r--r--arch/x86/mm/init_64.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index b3940b6b4d7e..104d56a9245f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -712,36 +712,22 @@ EXPORT_SYMBOL_GPL(arch_add_memory);
712 712
713static void __meminit free_pagetable(struct page *page, int order) 713static void __meminit free_pagetable(struct page *page, int order)
714{ 714{
715 struct zone *zone;
716 bool bootmem = false;
717 unsigned long magic; 715 unsigned long magic;
718 unsigned int nr_pages = 1 << order; 716 unsigned int nr_pages = 1 << order;
719 717
720 /* bootmem page has reserved flag */ 718 /* bootmem page has reserved flag */
721 if (PageReserved(page)) { 719 if (PageReserved(page)) {
722 __ClearPageReserved(page); 720 __ClearPageReserved(page);
723 bootmem = true;
724 721
725 magic = (unsigned long)page->lru.next; 722 magic = (unsigned long)page->lru.next;
726 if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) { 723 if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
727 while (nr_pages--) 724 while (nr_pages--)
728 put_page_bootmem(page++); 725 put_page_bootmem(page++);
729 } else 726 } else
730 __free_pages_bootmem(page, order); 727 while (nr_pages--)
728 free_reserved_page(page++);
731 } else 729 } else
732 free_pages((unsigned long)page_address(page), order); 730 free_pages((unsigned long)page_address(page), order);
733
734 /*
735 * SECTION_INFO pages and MIX_SECTION_INFO pages
736 * are all allocated by bootmem.
737 */
738 if (bootmem) {
739 zone = page_zone(page);
740 zone_span_writelock(zone);
741 zone->present_pages += nr_pages;
742 zone_span_writeunlock(zone);
743 totalram_pages += nr_pages;
744 }
745} 731}
746 732
747static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd) 733static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd)
@@ -1058,9 +1044,6 @@ static void __init register_page_bootmem_info(void)
1058 1044
1059void __init mem_init(void) 1045void __init mem_init(void)
1060{ 1046{
1061 long codesize, reservedpages, datasize, initsize;
1062 unsigned long absent_pages;
1063
1064 pci_iommu_alloc(); 1047 pci_iommu_alloc();
1065 1048
1066 /* clear_bss() already clear the empty_zero_page */ 1049 /* clear_bss() already clear the empty_zero_page */
@@ -1068,29 +1051,14 @@ void __init mem_init(void)
1068 register_page_bootmem_info(); 1051 register_page_bootmem_info();
1069 1052
1070 /* this will put all memory onto the freelists */ 1053 /* this will put all memory onto the freelists */
1071 totalram_pages = free_all_bootmem(); 1054 free_all_bootmem();
1072
1073 absent_pages = absent_pages_in_range(0, max_pfn);
1074 reservedpages = max_pfn - totalram_pages - absent_pages;
1075 after_bootmem = 1; 1055 after_bootmem = 1;
1076 1056
1077 codesize = (unsigned long) &_etext - (unsigned long) &_text;
1078 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
1079 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
1080
1081 /* Register memory areas for /proc/kcore */ 1057 /* Register memory areas for /proc/kcore */
1082 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START, 1058 kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
1083 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER); 1059 VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
1084 1060
1085 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, " 1061 mem_init_print_info(NULL);
1086 "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
1087 nr_free_pages() << (PAGE_SHIFT-10),
1088 max_pfn << (PAGE_SHIFT-10),
1089 codesize >> 10,
1090 absent_pages << (PAGE_SHIFT-10),
1091 reservedpages << (PAGE_SHIFT-10),
1092 datasize >> 10,
1093 initsize >> 10);
1094} 1062}
1095 1063
1096#ifdef CONFIG_DEBUG_RODATA 1064#ifdef CONFIG_DEBUG_RODATA
@@ -1166,11 +1134,10 @@ void mark_rodata_ro(void)
1166 set_memory_ro(start, (end-start) >> PAGE_SHIFT); 1134 set_memory_ro(start, (end-start) >> PAGE_SHIFT);
1167#endif 1135#endif
1168 1136
1169 free_init_pages("unused kernel memory", 1137 free_init_pages("unused kernel",
1170 (unsigned long) __va(__pa_symbol(text_end)), 1138 (unsigned long) __va(__pa_symbol(text_end)),
1171 (unsigned long) __va(__pa_symbol(rodata_start))); 1139 (unsigned long) __va(__pa_symbol(rodata_start)));
1172 1140 free_init_pages("unused kernel",
1173 free_init_pages("unused kernel memory",
1174 (unsigned long) __va(__pa_symbol(rodata_end)), 1141 (unsigned long) __va(__pa_symbol(rodata_end)),
1175 (unsigned long) __va(__pa_symbol(_sdata))); 1142 (unsigned long) __va(__pa_symbol(_sdata)));
1176} 1143}