hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/nios2/mm/init.c
....@@ -23,13 +23,12 @@
2323 #include <linux/mm.h>
2424 #include <linux/init.h>
2525 #include <linux/pagemap.h>
26
-#include <linux/bootmem.h>
26
+#include <linux/memblock.h>
2727 #include <linux/slab.h>
2828 #include <linux/binfmts.h>
2929
3030 #include <asm/setup.h>
3131 #include <asm/page.h>
32
-#include <asm/pgtable.h>
3332 #include <asm/sections.h>
3433 #include <asm/tlb.h>
3534 #include <asm/mmu_context.h>
....@@ -46,17 +45,15 @@
4645 */
4746 void __init paging_init(void)
4847 {
49
- unsigned long zones_size[MAX_NR_ZONES];
50
-
51
- memset(zones_size, 0, sizeof(zones_size));
48
+ unsigned long max_zone_pfn[MAX_NR_ZONES] = { 0 };
5249
5350 pagetable_init();
5451 pgd_current = swapper_pg_dir;
5552
56
- zones_size[ZONE_NORMAL] = max_mapnr;
53
+ max_zone_pfn[ZONE_NORMAL] = max_mapnr;
5754
5855 /* pass the memory from the bootmem allocator to the main allocator */
59
- free_area_init(zones_size);
56
+ free_area_init(max_zone_pfn);
6057
6158 flush_dcache_range((unsigned long)empty_zero_page,
6259 (unsigned long)empty_zero_page + PAGE_SIZE);
....@@ -73,25 +70,13 @@
7370 high_memory = __va(end_mem);
7471
7572 /* this will put all memory onto the freelists */
76
- free_all_bootmem();
73
+ memblock_free_all();
7774 mem_init_print_info(NULL);
7875 }
7976
8077 void __init mmu_init(void)
8178 {
8279 flush_tlb_all();
83
-}
84
-
85
-#ifdef CONFIG_BLK_DEV_INITRD
86
-void __init free_initrd_mem(unsigned long start, unsigned long end)
87
-{
88
- free_reserved_area((void *)start, (void *)end, -1, "initrd");
89
-}
90
-#endif
91
-
92
-void __ref free_initmem(void)
93
-{
94
- free_initmem_default(-1);
9580 }
9681
9782 #define __page_aligned(order) __aligned(PAGE_SIZE << (order))
....@@ -124,14 +109,14 @@
124109 struct mm_struct *mm = current->mm;
125110 int ret;
126111
127
- down_write(&mm->mmap_sem);
112
+ mmap_write_lock(mm);
128113
129114 /* Map kuser helpers to user space address */
130115 ret = install_special_mapping(mm, KUSER_BASE, KUSER_SIZE,
131116 VM_READ | VM_EXEC | VM_MAYREAD |
132117 VM_MAYEXEC, kuser_page);
133118
134
- up_write(&mm->mmap_sem);
119
+ mmap_write_unlock(mm);
135120
136121 return ret;
137122 }