[RFC] ARM: DMA coherent allocator: align remapped addresses
Anders Grafström
grfstrm at users.sourceforge.net
Wed Sep 22 10:49:22 EDT 2010
On 2010-07-25 15:50, Russell King - ARM Linux wrote:
> + * Align the virtual region allocation - maximum alignment is
> + * a section size, minimum is a page size. This helps reduce
> + * fragmentation of the DMA space, and also prevents allocations
> + * smaller than a section from crossing a section boundary.
> + */
> + bit = fls(size - 1) + 1;
> + if (bit > SECTION_SHIFT)
> + bit = SECTION_SHIFT;
> + align = 1 << bit;
A size of 4096 results in an alignment of 8192. Is that really intended?
ixp4xx seems to run out of vmregion due to this. The patch below makes it work again.
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 4bc43e5..7012105 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -198,7 +198,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
* fragmentation of the DMA space, and also prevents allocations
* smaller than a section from crossing a section boundary.
*/
- bit = fls(size - 1) + 1;
+ bit = fls(size - 1);
if (bit > SECTION_SHIFT)
bit = SECTION_SHIFT;
align = 1 << bit;
More information about the linux-arm-kernel
mailing list