Commit 976d6dfbb0175d136fc098854bbce0c028a3924b
Committed by
Linus Torvalds
1 parent
bad44b5be8
Exists in
master
and in
20 other branches
vmalloc(): adjust gfp mask passed on nested vmalloc() invocation
- avoid wasting more precious resources (DMA or DMA32 pools), when being called through vmalloc_32{,_user}() - explicitly allow using high memory here even if the outer allocation request doesn't allow it Signed-off-by: Jan Beulich <jbeulich@novell.com> Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 3 additions and 4 deletions Side-by-side Diff
mm/vmalloc.c
... | ... | @@ -1411,6 +1411,7 @@ |
1411 | 1411 | { |
1412 | 1412 | struct page **pages; |
1413 | 1413 | unsigned int nr_pages, array_size, i; |
1414 | + gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; | |
1414 | 1415 | |
1415 | 1416 | nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT; |
1416 | 1417 | array_size = (nr_pages * sizeof(struct page *)); |
1417 | 1418 | |
... | ... | @@ -1418,13 +1419,11 @@ |
1418 | 1419 | area->nr_pages = nr_pages; |
1419 | 1420 | /* Please note that the recursion is strictly bounded. */ |
1420 | 1421 | if (array_size > PAGE_SIZE) { |
1421 | - pages = __vmalloc_node(array_size, 1, gfp_mask | __GFP_ZERO, | |
1422 | + pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM, | |
1422 | 1423 | PAGE_KERNEL, node, caller); |
1423 | 1424 | area->flags |= VM_VPAGES; |
1424 | 1425 | } else { |
1425 | - pages = kmalloc_node(array_size, | |
1426 | - (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO, | |
1427 | - node); | |
1426 | + pages = kmalloc_node(array_size, nested_gfp, node); | |
1428 | 1427 | } |
1429 | 1428 | area->pages = pages; |
1430 | 1429 | area->caller = caller; |