public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Q] Why does dma_alloc_coherent() of ia64 GFP_DMA?
@ 2008-11-10  4:47 Yasunori Goto
  2008-11-10 12:59 ` Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Yasunori Goto @ 2008-11-10  4:47 UTC (permalink / raw)
  To: Luck, Tony; +Cc: FUJITA Tomonori, linux-ia64, Linux Kernel ML, Joerg Roedel


Hello. 

I have a (may be dumb) question about dma_alloc_coherent() for ia64.


Why does dma_alloc_coherent() of ia64 force GFP_DMA yet?
And why is swiotlb_dma_alloc_coherent() default routine of
platform_dma_alloc_coherent()?

-------
#define dma_alloc_coherent(dev, size, handle, gfp)      \
        platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA)
--------

Even if a device allows over 4G access and the driver doesn't specify
GFP_DMA, dma_alloc_coherent() returns under 4G area.
I guess many people think this is not so big issue because drivers require
very small memory generally.

However, I think this has the possibility of a finishing blow of OOM.
For example,

  1) Page caches occupy normal zone, and DMA zone is free.
  2) A user's application requires a few GB memory and mlock it.
     All DMA zone is occupied by it.
  3) A device which allows over 4GB is hot-added.
     But dma_alloc_coherent() try to allocate DMA zone.
     Then OOM occurs because there is no freeable pages.

I heard there are some users who require a few GB mlock.
There are similar trouble in past. 


If GFP_DMA is removed from above definition of dma_alloc_coherent(),
what will happen?

If it is not allowed, how is followings?

dma_alloc_coherent()
  -> platform_dma_alloc_coherent()
       -> normal_alloc_coherent()
          {
                 if (dma_mask allow over 4G)
                        ret = __get_free_pages();
				:
                        (check validation of returned address)
				:
                 else 
                        swiotlb_alloc_coherent();
          }
}

If I'm something misunderstanding, please let me know.


Thanks.

-- 
Yasunori Goto 



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-11-12  1:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-10  4:47 [Q] Why does dma_alloc_coherent() of ia64 GFP_DMA? Yasunori Goto
2008-11-10 12:59 ` Andi Kleen
2008-11-10 19:07   ` Robin Holt
2008-11-10 21:57     ` Christoph Lameter
2008-11-11  5:14   ` Yasunori Goto
2008-11-11  5:48   ` FUJITA Tomonori
2008-11-10 22:06 ` Christoph Lameter
2008-11-11  5:39   ` Yasunori Goto
2008-11-11 20:34     ` Christoph Lameter
2008-11-11  5:53   ` FUJITA Tomonori
2008-11-11 20:32     ` Christoph Lameter
2008-11-12  1:40       ` FUJITA Tomonori
2008-11-11  5:41 ` FUJITA Tomonori
2008-11-11  6:21   ` Yasunori Goto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox