CMA question

Johannes Thoma johannes at johannesthoma.com
Sun Feb 26 11:29:05 EST 2017


Dear Kernel hackers,

As far as I understood CMA (contiguous memory allocation) memory is used 
for other purposes as long it isn't requested via cma_alloc() by a 
driver. cma_alloc then tries to free the memory by relocating it and 
returns the contiguous area.

I have a case where cma_alloc() sometimes fails to relocate the memory 
which causes my driver (a GPU driver) to fail starting up (the driver is 
started when the system is running for a while). Is there a way to 
prevent the CM allocator to use the memory for any other purpose? Or 
should I better use another mechanism to allocate  contiguous memory at 
boot time (is there a framework for doing so)?

PS: I once had a patch which tries harder to relocate the pages (I 
patched cma_alloc()), but it didn't really work well, blocking the 
allocation for seconds.

Thanks for your advice,

- Johannes



More information about the Kernelnewbies mailing list