| .. | .. |
|---|
| 23 | 23 | #include <linux/mm.h> |
|---|
| 24 | 24 | #include <linux/init.h> |
|---|
| 25 | 25 | #include <linux/pagemap.h> |
|---|
| 26 | | -#include <linux/bootmem.h> |
|---|
| 26 | +#include <linux/memblock.h> |
|---|
| 27 | 27 | #include <linux/slab.h> |
|---|
| 28 | 28 | #include <linux/binfmts.h> |
|---|
| 29 | 29 | |
|---|
| 30 | 30 | #include <asm/setup.h> |
|---|
| 31 | 31 | #include <asm/page.h> |
|---|
| 32 | | -#include <asm/pgtable.h> |
|---|
| 33 | 32 | #include <asm/sections.h> |
|---|
| 34 | 33 | #include <asm/tlb.h> |
|---|
| 35 | 34 | #include <asm/mmu_context.h> |
|---|
| .. | .. |
|---|
| 46 | 45 | */ |
|---|
| 47 | 46 | void __init paging_init(void) |
|---|
| 48 | 47 | { |
|---|
| 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 }; |
|---|
| 52 | 49 | |
|---|
| 53 | 50 | pagetable_init(); |
|---|
| 54 | 51 | pgd_current = swapper_pg_dir; |
|---|
| 55 | 52 | |
|---|
| 56 | | - zones_size[ZONE_NORMAL] = max_mapnr; |
|---|
| 53 | + max_zone_pfn[ZONE_NORMAL] = max_mapnr; |
|---|
| 57 | 54 | |
|---|
| 58 | 55 | /* pass the memory from the bootmem allocator to the main allocator */ |
|---|
| 59 | | - free_area_init(zones_size); |
|---|
| 56 | + free_area_init(max_zone_pfn); |
|---|
| 60 | 57 | |
|---|
| 61 | 58 | flush_dcache_range((unsigned long)empty_zero_page, |
|---|
| 62 | 59 | (unsigned long)empty_zero_page + PAGE_SIZE); |
|---|
| .. | .. |
|---|
| 73 | 70 | high_memory = __va(end_mem); |
|---|
| 74 | 71 | |
|---|
| 75 | 72 | /* this will put all memory onto the freelists */ |
|---|
| 76 | | - free_all_bootmem(); |
|---|
| 73 | + memblock_free_all(); |
|---|
| 77 | 74 | mem_init_print_info(NULL); |
|---|
| 78 | 75 | } |
|---|
| 79 | 76 | |
|---|
| 80 | 77 | void __init mmu_init(void) |
|---|
| 81 | 78 | { |
|---|
| 82 | 79 | 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); |
|---|
| 95 | 80 | } |
|---|
| 96 | 81 | |
|---|
| 97 | 82 | #define __page_aligned(order) __aligned(PAGE_SIZE << (order)) |
|---|
| .. | .. |
|---|
| 124 | 109 | struct mm_struct *mm = current->mm; |
|---|
| 125 | 110 | int ret; |
|---|
| 126 | 111 | |
|---|
| 127 | | - down_write(&mm->mmap_sem); |
|---|
| 112 | + mmap_write_lock(mm); |
|---|
| 128 | 113 | |
|---|
| 129 | 114 | /* Map kuser helpers to user space address */ |
|---|
| 130 | 115 | ret = install_special_mapping(mm, KUSER_BASE, KUSER_SIZE, |
|---|
| 131 | 116 | VM_READ | VM_EXEC | VM_MAYREAD | |
|---|
| 132 | 117 | VM_MAYEXEC, kuser_page); |
|---|
| 133 | 118 | |
|---|
| 134 | | - up_write(&mm->mmap_sem); |
|---|
| 119 | + mmap_write_unlock(mm); |
|---|
| 135 | 120 | |
|---|
| 136 | 121 | return ret; |
|---|
| 137 | 122 | } |
|---|