Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1717736
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.12 21/41] mm/vmalloc.c: dont unconditonally use __GFP_HIGHMEM |
| Date | 2017-08-22 21:30 +0200 |
| Message-ID | <uhn2a-6Mv-17@gated-at.bofh.it> (permalink) |
| References | <uhmSu-6HP-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laura Abbott <labbott@redhat.com>
commit 704b862f9efd6d4c87a8d0a344dda19bda9c6b69 upstream.
Commit 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitly") added
use of __GFP_HIGHMEM for allocations. vmalloc_32 may use
GFP_DMA/GFP_DMA32 which does not play nice with __GFP_HIGHMEM and will
trigger a BUG in gfp_zone.
Only add __GFP_HIGHMEM if we aren't using GFP_DMA/GFP_DMA32.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1482249
Link: http://lkml.kernel.org/r/20170816220705.31374-1-labbott@redhat.com
Fixes: 19809c2da28a ("mm, vmalloc: use __GFP_HIGHMEM implicitly")
Signed-off-by: Laura Abbott <labbott@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/vmalloc.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1669,7 +1669,10 @@ static void *__vmalloc_area_node(struct
struct page **pages;
unsigned int nr_pages, array_size, i;
const gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
- const gfp_t alloc_mask = gfp_mask | __GFP_HIGHMEM | __GFP_NOWARN;
+ const gfp_t alloc_mask = gfp_mask | __GFP_NOWARN;
+ const gfp_t highmem_mask = (gfp_mask & (GFP_DMA | GFP_DMA32)) ?
+ 0 :
+ __GFP_HIGHMEM;
nr_pages = get_vm_area_size(area) >> PAGE_SHIFT;
array_size = (nr_pages * sizeof(struct page *));
@@ -1677,7 +1680,7 @@ static void *__vmalloc_area_node(struct
area->nr_pages = nr_pages;
/* Please note that the recursion is strictly bounded. */
if (array_size > PAGE_SIZE) {
- pages = __vmalloc_node(array_size, 1, nested_gfp|__GFP_HIGHMEM,
+ pages = __vmalloc_node(array_size, 1, nested_gfp|highmem_mask,
PAGE_KERNEL, node, area->caller);
} else {
pages = kmalloc_node(array_size, nested_gfp, node);
@@ -1698,9 +1701,9 @@ static void *__vmalloc_area_node(struct
}
if (node == NUMA_NO_NODE)
- page = alloc_page(alloc_mask);
+ page = alloc_page(alloc_mask|highmem_mask);
else
- page = alloc_pages_node(node, alloc_mask, 0);
+ page = alloc_pages_node(node, alloc_mask|highmem_mask, 0);
if (unlikely(!page)) {
/* Successfully allocated i pages, free them in __vunmap() */
@@ -1708,7 +1711,7 @@ static void *__vmalloc_area_node(struct
goto fail;
}
area->pages[i] = page;
- if (gfpflags_allow_blocking(gfp_mask))
+ if (gfpflags_allow_blocking(gfp_mask|highmem_mask))
cond_resched();
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.12 00/41] 4.12.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 28/41] perf/x86: Fix RDPMC vs. mm_struct tracking Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 09/41] md: fix test in md_write_start() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 31/41] x86/elf: Remove the unnecessary ADDR_NO_RANDOMIZE checks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 19/41] mm/cma_debug.c: fix stack corruption due to sprintf usage Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 21/41] mm/vmalloc.c: dont unconditonally use __GFP_HIGHMEM Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 02/41] parisc: pci memory bar assignment fails with 64bit kernels on dino/cujo Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 10/41] md: always clear ->safemode when md_check_recovery gets the mddev lock. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 25/41] blk-mq-pci: add a fallback when pci_irq_get_affinity returns NULL Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 05/41] drm/i915: Perform an invalidate prior to executing golden renderstate Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 22/41] mm: revert x86_64 and arm64 ELF_ET_DYN_BASE base changes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 01/41] audit: Fix use after free in audit_remove_watch_rule() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 27/41] xen-blkfront: use a right index when checking requests Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 18/41] mm: fix double mmap_sem unlock on MMF_UNSTABLE enforced SIGBUS Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 32/41] irqchip/atmel-aic: Fix unbalanced of_node_put() in aic_common_irq_fixup() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
[PATCH 4.12 29/41] x86/asm/64: Clear AC on NMI entries Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-22 21:30 +0200
Re: [PATCH 4.12 00/41] 4.12.9-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-08-23 02:40 +0200
Re: [PATCH 4.12 00/41] 4.12.9-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-23 02:50 +0200
csiph-web