diff options
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 8698c1c86c4d..a47e3894c775 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -1671,7 +1671,10 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, | |||
1671 | struct page **pages; | 1671 | struct page **pages; |
1672 | unsigned int nr_pages, array_size, i; | 1672 | unsigned int nr_pages, array_size, i; |
1673 | const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; | 1673 | const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO; |
1674 | const gfp_t alloc_mask = gfp_mask | __GFP_HIGHMEM | __GFP_NOWARN; | 1674 | const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN; |
1675 | const gfp_t highmem_mask = (gfp_mask & (GFP_DMA | GFP_DMA32)) ? | ||
1676 | 0 : | ||
1677 | __GFP_HIGHMEM; | ||
1675 | 1678 | ||
1676 | nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; | 1679 | nr_pages = get_vm_area_size(area) >> PAGE_SHIFT; |
1677 | array_size = (nr_pages * sizeof(struct page *)); | 1680 | array_size = (nr_pages * sizeof(struct page *)); |
@@ -1679,7 +1682,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, | |||
1679 | area->nr_pages = nr_pages; | 1682 | area->nr_pages = nr_pages; |
1680 | /* Please note that the recursion is strictly bounded. */ | 1683 | /* Please note that the recursion is strictly bounded. */ |
1681 | if (array_size > PAGE_SIZE) { | 1684 | if (array_size > PAGE_SIZE) { |
1682 | pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM, | 1685 | pages = __vmalloc_node(array_size, 1, nested_gfp|highmem_mask, |
1683 | PAGE_KERNEL, node, area->caller); | 1686 | PAGE_KERNEL, node, area->caller); |
1684 | } else { | 1687 | } else { |
1685 | pages = kmalloc_node(array_size, nested_gfp, node); | 1688 | pages = kmalloc_node(array_size, nested_gfp, node); |
@@ -1700,9 +1703,9 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, | |||
1700 | } | 1703 | } |
1701 | 1704 | ||
1702 | if (node == NUMA_NO_NODE) | 1705 | if (node == NUMA_NO_NODE) |
1703 | page = alloc_page(alloc_mask); | 1706 | page = alloc_page(alloc_mask|highmem_mask); |
1704 | else | 1707 | else |
1705 | page = alloc_pages_node(node, alloc_mask, 0); | 1708 | page = alloc_pages_node(node, alloc_mask|highmem_mask, 0); |
1706 | 1709 | ||
1707 | if (unlikely(!page)) { | 1710 | if (unlikely(!page)) { |
1708 | /* Successfully allocated i pages, free them in __vunmap() */ | 1711 | /* Successfully allocated i pages, free them in __vunmap() */ |
@@ -1710,7 +1713,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, | |||
1710 | goto fail; | 1713 | goto fail; |
1711 | } | 1714 | } |
1712 | area->pages[i] = page; | 1715 | area->pages[i] = page; |
1713 | if (gfpflags_allow_blocking(gfp_mask)) | 1716 | if (gfpflags_allow_blocking(gfp_mask|highmem_mask)) |
1714 | cond_resched(); | 1717 | cond_resched(); |
1715 | } | 1718 | } |
1716 | 1719 | ||