diff options
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 1d8b32f07139..21fdf46ad5aa 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1118,6 +1118,32 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t pro | |||
1118 | EXPORT_SYMBOL(vm_map_ram); | 1118 | EXPORT_SYMBOL(vm_map_ram); |
1119 | 1119 | ||
1120 | /** | 1120 | /** |
1121 | * vm_area_add_early - add vmap area early during boot | ||
1122 | * @vm: vm_struct to add | ||
1123 | * | ||
1124 | * This function is used to add fixed kernel vm area to vmlist before | ||
1125 | * vmalloc_init() is called. @vm->addr, @vm->size, and @vm->flags | ||
1126 | * should contain proper values and the other fields should be zero. | ||
1127 | * | ||
1128 | * DO NOT USE THIS FUNCTION UNLESS YOU KNOW WHAT YOU'RE DOING. | ||
1129 | */ | ||
1130 | void __init vm_area_add_early(struct vm_struct *vm) | ||
1131 | { | ||
1132 | struct vm_struct *tmp, **p; | ||
1133 | |||
1134 | BUG_ON(vmap_initialized); | ||
1135 | for (p = &vmlist; (tmp = *p) != NULL; p = &tmp->next) { | ||
1136 | if (tmp->addr >= vm->addr) { | ||
1137 | BUG_ON(tmp->addr < vm->addr + vm->size); | ||
1138 | break; | ||
1139 | } else | ||
1140 | BUG_ON(tmp->addr + tmp->size > vm->addr); | ||
1141 | } | ||
1142 | vm->next = *p; | ||
1143 | *p = vm; | ||
1144 | } | ||
1145 | |||
1146 | /** | ||
1121 | * vm_area_register_early - register vmap area early during boot | 1147 | * vm_area_register_early - register vmap area early during boot |
1122 | * @vm: vm_struct to register | 1148 | * @vm: vm_struct to register |
1123 | * @align: requested alignment | 1149 | * @align: requested alignment |
@@ -1139,8 +1165,7 @@ void __init vm_area_register_early(struct vm_struct *vm, size_t align) | |||
1139 | 1165 | ||
1140 | vm->addr = (void *)addr; | 1166 | vm->addr = (void *)addr; |
1141 | 1167 | ||
1142 | vm->next = vmlist; | 1168 | vm_area_add_early(vm); |
1143 | vmlist = vm; | ||
1144 | } | 1169 | } |
1145 | 1170 | ||
1146 | void __init vmalloc_init(void) | 1171 | void __init vmalloc_init(void) |
@@ -1290,7 +1315,7 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, | |||
1290 | unsigned long align, unsigned long flags, unsigned long start, | 1315 | unsigned long align, unsigned long flags, unsigned long start, |
1291 | unsigned long end, int node, gfp_t gfp_mask, void *caller) | 1316 | unsigned long end, int node, gfp_t gfp_mask, void *caller) |
1292 | { | 1317 | { |
1293 | static struct vmap_area *va; | 1318 | struct vmap_area *va; |
1294 | struct vm_struct *area; | 1319 | struct vm_struct *area; |
1295 | 1320 | ||
1296 | BUG_ON(in_interrupt()); | 1321 | BUG_ON(in_interrupt()); |