kmalloc is a kernel memory allocation function, such as malloc() in user space. Memory returned by kmalloc is contiguous in physical memory and in virtual memory:
The kmalloc allocator is the general and higher-level memory allocator in the kernel, which relies on the SLAB allocator. Memory returned from kmalloc has a kernel logical address because it is allocated from the LOW_MEM region, unless HIGH_MEM is specified. It is declared in <linux/slab.h>, which is the header to include when using kmalloc in your driver. The following is the prototype:
void *kmalloc(size_t size, int flags);
size specifies the size of ...