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>
This commit is contained in:
Родитель
bad44b5be8
Коммит
976d6dfbb0
|
@ -1411,6 +1411,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
|
||||||
{
|
{
|
||||||
struct page **pages;
|
struct page **pages;
|
||||||
unsigned int nr_pages, array_size, i;
|
unsigned int nr_pages, array_size, i;
|
||||||
|
gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
|
||||||
|
|
||||||
nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT;
|
nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT;
|
||||||
array_size = (nr_pages * sizeof(struct page *));
|
array_size = (nr_pages * sizeof(struct page *));
|
||||||
|
@ -1418,13 +1419,11 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
|
||||||
area->nr_pages = nr_pages;
|
area->nr_pages = nr_pages;
|
||||||
/* Please note that the recursion is strictly bounded. */
|
/* Please note that the recursion is strictly bounded. */
|
||||||
if (array_size > PAGE_SIZE) {
|
if (array_size > PAGE_SIZE) {
|
||||||
pages = __vmalloc_node(array_size, 1, gfp_mask | __GFP_ZERO,
|
pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM,
|
||||||
PAGE_KERNEL, node, caller);
|
PAGE_KERNEL, node, caller);
|
||||||
area->flags |= VM_VPAGES;
|
area->flags |= VM_VPAGES;
|
||||||
} else {
|
} else {
|
||||||
pages = kmalloc_node(array_size,
|
pages = kmalloc_node(array_size, nested_gfp, node);
|
||||||
(gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO,
|
|
||||||
node);
|
|
||||||
}
|
}
|
||||||
area->pages = pages;
|
area->pages = pages;
|
||||||
area->caller = caller;
|
area->caller = caller;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче