Thanks for your replied. I surveyed in the internet and found the kerenl's kmalloc API also return a continuous memory address. Is it right? So there are two kernel APIs (__get_free_page, kmalloc) return a _continuous_ memory address (virtual address) and it can be convert to physical address by virt_to_phys(). BRs, H. Johnny 2009/11/13 Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx>: > On 11/12/09, Johnny Hung <johnny.hacking@xxxxxxxxx> wrote: >> Hi All: >> I am writing user space application and need to allocate a >> continuous memory. The size is just 64KB and I also need to know the >> allocated physical memory address. Is is possible to do it in user >> space or it should be done it kernel space? > > To the best I know, in user space, all kind of memory allocation done > via functions like malloc(), mmap(), brk etc never guarantees > continous physical memory. Only continous virtual memory. The reason > is that they are all basically just reserve or extend existing VMA. > The real allocation, which is done on per page basis, is deferred 'til > page fault happen. > >>BTW, how to allocate >> continuous physical memory and got it physical address in kernel >> space? > > IIRC, get_free_pages(). I might be wrong though...The return value of > this function is the starting virtual address of the page. And to > convert it to physical address, IIRC, you can use virt_to_phys() > function. > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com > training: mulyaditraining.blogspot.com > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ