CMA question

Johannes Thoma johannes at johannesthoma.com
Tue Feb 28 12:48:18 EST 2017


Hello,

Am 28.02.17 um 11:04 schrieb Thomas Petazzoni:
> Hello,
>
> On Sun, 26 Feb 2017 18:14:42 +0100, Johannes Thoma wrote:
>
>> As you pointed out the solution would be to allocate the memory earlier in the
>> boot process, by modifying the driver. I will try that in the next few days and
>> let you know the result.
>
> The whole point of CMA is that allocating earlier in the boot process
> should not be necessary. CMA guarantees that the memory reserved for
> the CMA pool is "movable", i.e it can be discarded when a CMA
> allocation is done.
>
Yes it is moveable, but it takes rather long until it is moved (up to
20 Seconds). To test this I've implemented a loop that restarts from
beginning of the CMA area as long as alloc_contig_range() returns
-EBUSY (something similar to
https://www.mail-archive.com/kernelnewbies@kernelnewbies.org/msg16956.html
). The result (on my system, which is an ARM based IMX-6 SOC) is that
after some while it always succeeds but it takes some time.

> So if a CMA allocation fails, I would rather suggest that the size of
> your CMA pool is not large enough. Check your Device Tree and/or kernel
> command (you can specify the size of the CMA pool on both if I remember
> correctly).
>
We use kernel command line to set the CMA size, so I will try as you
suggested.

Thanks a lot,

- Johannes



More information about the Kernelnewbies mailing list