aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/pci-dma.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-06-16 05:27:18 -0400
committerIngo Molnar <mingo@elte.hu>2008-06-16 05:27:18 -0400
commit33ee375b2ea5dd11581a57d67bedd0ca39b19a5e (patch)
tree411d3a04936e281e54680ad082f98d985561bce5 /arch/x86/kernel/pci-dma.c
parent6703f6d10dcd3316e03641a5ecaa6c8a04374d98 (diff)
parent066519068ad2fbe98c7f45552b1f592903a9c8c8 (diff)
Merge branch 'linus' into x86/gart
Diffstat (limited to 'arch/x86/kernel/pci-dma.c')
-rw-r--r--arch/x86/kernel/pci-dma.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 7747bc82b11d..09c4dac11b5f 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -379,6 +379,7 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
379 struct page *page; 379 struct page *page;
380 unsigned long dma_mask = 0; 380 unsigned long dma_mask = 0;
381 dma_addr_t bus; 381 dma_addr_t bus;
382 int noretry = 0;
382 383
383 /* ignore region specifiers */ 384 /* ignore region specifiers */
384 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); 385 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
@@ -398,20 +399,25 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
398 if (dev->dma_mask == NULL) 399 if (dev->dma_mask == NULL)
399 return NULL; 400 return NULL;
400 401
401 /* Don't invoke OOM killer */ 402 /* Don't invoke OOM killer or retry in lower 16MB DMA zone */
402 gfp |= __GFP_NORETRY; 403 if (gfp & __GFP_DMA)
404 noretry = 1;
403 405
404#ifdef CONFIG_X86_64 406#ifdef CONFIG_X86_64
405 /* Why <=? Even when the mask is smaller than 4GB it is often 407 /* Why <=? Even when the mask is smaller than 4GB it is often
406 larger than 16MB and in this case we have a chance of 408 larger than 16MB and in this case we have a chance of
407 finding fitting memory in the next higher zone first. If 409 finding fitting memory in the next higher zone first. If
408 not retry with true GFP_DMA. -AK */ 410 not retry with true GFP_DMA. -AK */
409 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) 411 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) {
410 gfp |= GFP_DMA32; 412 gfp |= GFP_DMA32;
413 if (dma_mask < DMA_32BIT_MASK)
414 noretry = 1;
415 }
411#endif 416#endif
412 417
413 again: 418 again:
414 page = dma_alloc_pages(dev, gfp, get_order(size)); 419 page = dma_alloc_pages(dev,
420 noretry ? gfp | __GFP_NORETRY : gfp, get_order(size));
415 if (page == NULL) 421 if (page == NULL)
416 return NULL; 422 return NULL;
417 423