Commit 8f19ca13 authored by Glauber Costa's avatar Glauber Costa Committed by Ingo Molnar

x86: unify gfp masks

Use the same gfp masks for x86_64 and i386.
It involves using HIGHMEM or DMA32 where necessary, for the sake
of code compatibility, (no real effect), and using the NORETRY
mask for i386.
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5fa78ca7
...@@ -79,7 +79,7 @@ void *dma_alloc_coherent(struct device *dev, size_t size, ...@@ -79,7 +79,7 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
unsigned long dma_mask = 0; unsigned long dma_mask = 0;
/* ignore region specifiers */ /* ignore region specifiers */
gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &ret)) if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &ret))
return ret; return ret;
...@@ -91,7 +91,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, ...@@ -91,7 +91,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
if (dma_mask == 0) if (dma_mask == 0)
dma_mask = DMA_32BIT_MASK; dma_mask = DMA_32BIT_MASK;
again: /* Don't invoke OOM killer */
gfp |= __GFP_NORETRY;
again:
page = dma_alloc_pages(dev, gfp, order); page = dma_alloc_pages(dev, gfp, order);
if (page == NULL) if (page == NULL)
return NULL; return NULL;
......
...@@ -49,6 +49,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, ...@@ -49,6 +49,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
unsigned long dma_mask = 0; unsigned long dma_mask = 0;
u64 bus; u64 bus;
/* ignore region specifiers */
gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory)) if (dma_alloc_from_coherent_mem(dev, size, dma_handle, &memory))
return memory; return memory;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment