Alignment problems: arm_memblock_steal() + dma_declare_coherent_memory()

javier Martin javier.martin at vista-silicon.com
Fri Sep 14 04:49:27 EDT 2012


Hello,
we use arm_memblock_steal() + dma_declare_coherent_memory() in order
to reserve son contiguous video memory in our platform:
http://git.linuxtv.org/media_tree.git/blob/refs/heads/staging/for_v3.7:/arch/arm/mach-imx/mach-imx27_visstrim_m10.c

We've noticed that some restrictive alignment constraints are being
applied. For example, for coda driver, the following allocations are
made:

coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 557056
bytes, out of 8388608 (vaddr = 0xc6000000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 65536
bytes, out of 8388608 (vaddr = 0xc6100000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 10240
bytes, out of 8388608 (vaddr = 0xc6110000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 622080
bytes, out of 8388608 (vaddr = 0xc6200000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 622080
bytes, out of 8388608 (vaddr = 0xc6300000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 622080
bytes, out of 8388608 (vaddr = 0xc6400000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 589824
bytes, out of 8388608 (vaddr = 0xc6500000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 589824
bytes, out of 8388608 (vaddr = 0xc6600000) PAGE_SHIFT = 0xc
coda coda-imx27.0: dma_alloc_from_coherent: try to allocate 622080
bytes, out of 8388608 (vaddr = 0xc6700000) PAGE_SHIFT = 0xc

If we take a look at the size of each allocation and the different
vaddr values we find that the alignment is 0x100000 = 1MB for values
like 622080 byte size. Why is that?
A lot of memory is being wasted this way and our HW does not have such
1MB alignment requirements.

Regards.
-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com



More information about the linux-arm-kernel mailing list