> 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().

Yes that's right, AFAIK kmap allocates physically contiguous memory
and vmalloc allocates virtual contiguous memory. Actually the 2
functions you're pointing out (__get_free_page and kmalloc) are not
independent. At its heart, the kernel allocator is page based so
kmalloc uses the same page based functions to allocate is memory -
infact the kmalloc interface is built on top of the slab layer (which
uses the page allocation functions to allocate memory), get_free_page
is just at a much lower level.

Out of curiosity, why do you need the physically addresses of the
memory you're allocating for your particular application?

Regards,
-Joel

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to