I think the choice between kmalloc, vmalloc and other distribution methods is implementation. The failure of each of them is also a contingent. If you need multiple pages of memory, rather go to page allocation methods. They are simple and fast. However, if you need a certain amount of data (expressed in bytes), the choice remains between kmalloc (and its variants) and vmalloc. kmalloc is faster and provides contiguous memory allocation (especially useful with DMA). The algorithm that implements it is very fast. However, if your memory is highly fragmented, a problem may arise when you request more memory. If it cannot find enough adjacent space, if it does not work, even though the memory has enough space to accommodate. vmalloc, on the other hand, does not require contiguous memory allocation. However, it is rather slow. It works by appropriately setting up entries in the page table. In addition, the kernel usually does not allocate much space for vmalloc.
So, in your case, I think it depends on what types of applications you use. However, using vmalloc instead of kmalloc is not a solution for most of the time (with the exception of large memory allocations in highly fragmented memory). In such cases, you can directly select the page distribution.
nick
source share