diff options
Diffstat (limited to 'mm/vmalloc.c')
| -rw-r--r-- | mm/vmalloc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 1133dd3aafcf..46606c133e82 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
| @@ -160,13 +160,15 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) | |||
| 160 | return err; | 160 | return err; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags, | 163 | static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags, |
| 164 | unsigned long start, unsigned long end, int node) | 164 | unsigned long start, unsigned long end, |
| 165 | int node, gfp_t gfp_mask) | ||
| 165 | { | 166 | { |
| 166 | struct vm_struct **p, *tmp, *area; | 167 | struct vm_struct **p, *tmp, *area; |
| 167 | unsigned long align = 1; | 168 | unsigned long align = 1; |
| 168 | unsigned long addr; | 169 | unsigned long addr; |
| 169 | 170 | ||
| 171 | BUG_ON(in_interrupt()); | ||
| 170 | if (flags & VM_IOREMAP) { | 172 | if (flags & VM_IOREMAP) { |
| 171 | int bit = fls(size); | 173 | int bit = fls(size); |
| 172 | 174 | ||
| @@ -180,7 +182,7 @@ struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long flags, | |||
| 180 | addr = ALIGN(start, align); | 182 | addr = ALIGN(start, align); |
| 181 | size = PAGE_ALIGN(size); | 183 | size = PAGE_ALIGN(size); |
| 182 | 184 | ||
| 183 | area = kmalloc_node(sizeof(*area), GFP_KERNEL, node); | 185 | area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node); |
| 184 | if (unlikely(!area)) | 186 | if (unlikely(!area)) |
| 185 | return NULL; | 187 | return NULL; |
| 186 | 188 | ||
| @@ -236,7 +238,7 @@ out: | |||
| 236 | struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, | 238 | struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, |
| 237 | unsigned long start, unsigned long end) | 239 | unsigned long start, unsigned long end) |
| 238 | { | 240 | { |
| 239 | return __get_vm_area_node(size, flags, start, end, -1); | 241 | return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL); |
| 240 | } | 242 | } |
| 241 | 243 | ||
| 242 | /** | 244 | /** |
| @@ -253,9 +255,11 @@ struct vm_struct *get_vm_area(unsigned long size, unsigned long flags) | |||
| 253 | return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END); | 255 | return __get_vm_area(size, flags, VMALLOC_START, VMALLOC_END); |
| 254 | } | 256 | } |
| 255 | 257 | ||
| 256 | struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags, int node) | 258 | struct vm_struct *get_vm_area_node(unsigned long size, unsigned long flags, |
| 259 | int node, gfp_t gfp_mask) | ||
| 257 | { | 260 | { |
| 258 | return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node); | 261 | return __get_vm_area_node(size, flags, VMALLOC_START, VMALLOC_END, node, |
| 262 | gfp_mask); | ||
| 259 | } | 263 | } |
| 260 | 264 | ||
| 261 | /* Caller must hold vmlist_lock */ | 265 | /* Caller must hold vmlist_lock */ |
| @@ -487,7 +491,7 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot, | |||
| 487 | if (!size || (size >> PAGE_SHIFT) > num_physpages) | 491 | if (!size || (size >> PAGE_SHIFT) > num_physpages) |
| 488 | return NULL; | 492 | return NULL; |
| 489 | 493 | ||
| 490 | area = get_vm_area_node(size, VM_ALLOC, node); | 494 | area = get_vm_area_node(size, VM_ALLOC, node, gfp_mask); |
| 491 | if (!area) | 495 | if (!area) |
| 492 | return NULL; | 496 | return NULL; |
| 493 | 497 | ||
