Re: Contiguous memory allocations
- Date: Mon, 05 Jul 2010 11:10:06 +0100
- From: Chris Simmonds <chris.simmonds@xxxxxxxxxx>
- Subject: Re: Contiguous memory allocations
On 02/07/10 21:47, Eric Nelson wrote:
Does anyone know if there's a common infrastructure for allocation
of DMA'able memory by drivers and applications above the straight
kernel API (dma_alloc_coherent)?
I'm working with Freescale i.MX51 drivers to do 720P video
input and output and the embedded calls to dma_alloc_coherent
fail except when used right after boot because of fragmentation.
I'm fighting the urge to write yet another special-purpose allocator
for video buffers thinking this must be a common problem with a
solution already, but I can't seem to locate one.
The closest thing I've found is the bigphysarea patch, which doesn't
appear to be supported or headed toward main-line.
Thanks in advance,
dma_alloc_coherent is pretty much just a wrapper round get_free_pages,
which is the lowest level allocator in the kernel. So, no there is no
other option (but see below). The simplest thing is to make sure your
driver is loaded at boot time and to grab all the memory you need then
and never let it go. That's what I do.
If you are desperate, you can use the bigphysarea patch - it's quite
common on streaming video devices - but you will have to port it to your
kernel. Or, you can restrict the memory the kernel uses with something
like "mem=128M" on the command line and take that above 128M for
yourself. You will have to map it in with ioremap(_nocache).
Bye for now,
Chris Simmonds 2net Limited
video4linux-list mailing list