Subject: Re: how to allocate 9MB of memory in kernel ?

From: Timur Tabi <[email-masked]>
Date: Fri, 18 Jul 2008 09:57:25 -0500

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