Contiguous Memory Allocator (CMA)

FMDF fmdefrancesco at
Sat Jan 8 17:14:07 EST 2022

On Sat, 8 Jan 2022, 14:37 Sadanand Warrier, <sadanandwarrier at>

> Hello Fabio
>    Thanks for the response. I had already accessed that link that you
> have pasted. Michal Nazarewicz also has a few other points on using
> CMA.
> When I tried to use the API after setting cma=128M on the kernel boot
> command line and booted the kernel, the api returned without
> allocating memory
> when the driver was installed.
> The dmesg shows that 128M was reserved for CMA but dma_alloc_coherent
> failed.
> It seems that default CentOS and perhaps Ubuntu kernels are not
> compiled with CONFIG_DMA_CMA=yes for the dma_alloc_coherent to work.
> I'm not sure if this is a valid assumption. I haven't tried
> recompiling the kernel yet with that option set.
> From what I have managed to eke out we need CONFIG_CMA=yes and
> CONFIG_DMA_CMA=yes too.

If I recall it well, I think they are needed. Why haven't you yet checked?

I assume that you know how to change your .config, re-build the kernel and
the modules and install everything in the right places. Don't you?

Just grep  the ".config" of your distro. It should be placed in /boot/ with
a name like "config-`uname -r`" or in /usr/src/linux/ with its true name
(.config) and see if those options are enabled. Or you may use directly
"make menuconfig" and search with its special keys. Then "make -jN && sudo
make modules_install install" (and hope that installkernel is not broken
like it has been in openSUSE Tumbleweed for weeks).  :(

I'm not an expert about this particular subject, so if they have already
been  enabled I cannot help you with more than the above information. That
article in is everything I've studied about this subject and I
haven't ever used it in kernel programming.


Fabio M. De Francesco

> Thanks
> S
> On Sat, 8 Jan 2022 at 07:23, FMDF <fmdefrancesco at> wrote:
> >
> > On Tue, 21 Dec 2021, 15:36 Sadanand Warrier, <sadanandwarrier at>
> wrote:
> >>
> >> Hello
> >>     Is CMA still supported as described in this document
> >> ?
> >
> >
> > Yes, it is.
> >
> > Read the following instructions on how to use that feature:
> >
> > "A deep dive into CMA" at
> >
> >
> > Regards,
> >
> > Fabio M. De Francesco
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Kernelnewbies mailing list