linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* minimum guaranteed alignment of dma_alloc_coherent?
@ 2011-02-05  0:14 Timur Tabi
  2011-02-05  1:09 ` Dan Malek
  0 siblings, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2011-02-05  0:14 UTC (permalink / raw)
  To: linuxppc-dev

Is there any official statement on what the minimum alignment is for
memory returned by dma_alloc_coherent?  I know that since it uses a
page allocator to do the actual allocation, that the memory is page
aligned (at least on PowerPC).  Is this something I can rely on?

Would anyone have a complaint if I did this:

vaddr = dma_alloc_coherent(dev, ssize, &paddr, GFP_DMA | __GFP_ZERO);
BUG_ON(paddr & (alignment - 1));

'alignment' will always be 32 or less.

The reason I ask is that I currently have code that ensures an
alignment, but it does so by allocating extra memory, and that seems
wasteful.

On a side note, do I really need to pass GFP_DMA when calling
dma_alloc_coherent?  That seems redundant, but I don't see the code
force it to be set.  Should it be forced on?

-- 
Timur Tabi
Linux kernel developer at Freescale

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

end of thread, other threads:[~2011-03-29  0:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-05  0:14 minimum guaranteed alignment of dma_alloc_coherent? Timur Tabi
2011-02-05  1:09 ` Dan Malek
2011-02-05  2:04   ` Tabi Timur-B04825
2011-02-05  2:56     ` Dan Malek
2011-02-07 15:13       ` Timur Tabi
2011-03-29  0:32         ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).