Contents
What is CMA reserved?
CMA works by reserving memory early at boot time. This memory, called a CMA area or a CMA context , is later returned to the buddy allocator so that it can be used by regular applications.
Is main memory reserved?
Setting aside a portion of main memory for some purpose. Memory is reserved for inputting data, additional software instructions or for the creation of control structures such as a stack. See dynamic memory allocation, memory allocation, buffer and stack.
What is DMA pool?
A DMA pool is an allocation mechanism for small, coherent DMA mappings. Mappings obtained from dma_alloc_coherent may have a minimum size of one page. If your device needs smaller DMA areas than that, you should probably be using a DMA pool.
How to reserve a block of memory in Linux?
To reserve a block of memory from the kernel in ARM based Linux, you can also use a reserved-memory node in your device tree (dts) file. In kernel documentation (see here ), there is an example:
How is memory allocated in the Linux kernel?
Linux provides a variety of APIs for memory allocation. You can allocate small chunks using kmalloc or kmem_cache_alloc families, large virtually contiguous areas using vmalloc and its derivatives, or you can directly request pages from the page allocator with alloc_pages .
How to allocate memory in kvmalloc in Linux?
Note that kvmalloc may return memory that is not physically contiguous. If you need to allocate many identical objects you can use the slab cache allocator. The cache should be set up with kmem_cache_create () or kmem_cache_create_usercopy () before it can be used.
Do you need a driver to reserve this memory?
You need to write a driver to reserve this memory. Yes, I realize you said you didn’t want the OS to intervene, and a driver becomes part of the OS, but in absence of a driver’s reservation, the kernel believes all memory belongs to it. (Unless you tell the kernel to ignore the memory block, per Aaron’s answer, that is.)