I've googled around and found most people advocating the use of kmalloc
, as you're guaranteed to get contiguous physical blocks of memory. However, it also seems as though kmalloc
can fail if a contiguous physical block that you want can't be found.
What are the advantages of having a contiguous block of memory? Specifically, why would I need to have a contiguous physical block of memory in a system call? Is there any reason I couldn't just use vmalloc
?
Finally, if I did use kmalloc
, since this is for a system call, should I specify GFP_ATOMIC
since, technically, a system call is called as part of an interrupt handler, and I read the following:
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.