malloc is used for user space memory allocation.
kmalloc and vmalloc are used for kernel space correspondingly.
vmalloc is just like malloc, which allocates a virtual continuous memory
kmalloc carrys 2 parameters, 2nd one is used for most of case without any specific request.


GFP_ATOMIC
The allocation is high-priority and does not sleep. This is the flag to use in interrupt handlers, bottom halves and other situations where you cannot sleep.


GFP_KERNEL This is a normal allocation and might block. This is the flag to use in process context code when it is safe to sleep.


Besides, it allocates physically contiguous memory   (also virtually contiguous) , which is DMAable by a subsystem.




side notes from  http://www.roman10.net/linux-kernel-programmingmemory-allocation/


Most of the memory allocations in Linux kernel are done using kmalloc, due to the following reasons:


  • hardware devices don’t understand virtual address. Therefore, their device drivers can only allocate memory using kmalloc.
  • better performance in most cases because physically contiguous memory region is more efficient than virtually contiguous memory. The reason behind this is not covered here, interested readers can search for Linux memory management articles.

hen a large chunk of memory is needed, vmalloc is used often as it doesn’t require physically contiguous memory and the kernel can satisfy the request with much less effort than using kmalloc.


http://www.win.tue.nl/~aeb/linux/lk/lk-9.html holds more analysis.