EmbLogic's Blog

vmalloc

vmalloc allocates a contiguous memory region in the virtual address space. Although the pages are not con-secutive in physical memory (each page is retrieved with a separate call to alloc_page),the kernel sees them as a contiguous range of addresses. vmalloc returns 0 (the NULL address) if an error occurs, otherwise, it returns a pointer to a linear memory area of size at least size.

Memory obtained from vmalloc is slightly less efficient to work with,
and, on some architectures, the amount of address space set aside for vmalloc is rela-
tively small. Code that uses vmalloc is likely to get a chilly reception if submitted for
inclusion in the kernel. If possible, you should work directly with individual pages
rather than trying to smooth things over with vmalloc.

One Response to vmalloc

  1. Manish says:

    Can we use vmalloc over kmalloc if yes then why and no then why not ?

Leave a Reply to Manish Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>