how to allocate 9MB of memory in kernel ?

Timur Tabi timur at freescale.com
Sat Jul 19 00:57:25 EST 2008


Misbah khan wrote:

> 4. Now we want our 9MB SDRAM to point to the kernel circular buffer we want
> our circular buffer to be mapped to continues paged so that we could map it
> to user space.

Physically contiguous or virtually contiguous?  I think you only need the 
buffer to be virtually contiguous, which vmalloc gives you.  You only need it 
to be physically contiguous if you are passing this buffer to hardware via DMA 
(and the hardware cannot handle scatter/gather).

If you need it to be physically contiguous, you'll have to use a function like 
alloc_pages() (or the new alloc_pages_exact, which will be in 2.6.27).  To 
allocate 9MB, you'll need to increase CONFIG_FORCE_MAX_ZONEORDER to 12.

-- 
Timur Tabi
Linux Kernel Developer @ Freescale


More information about the Linuxppc-embedded mailing list