On 7/1/26 18:08, Thierry Reding wrote:
> From: Thierry Reding <[email protected]>
> 
> There is no technical reason why there should be a limited number of CMA
> regions, so extract some code into helpers and use them to create extra
> functions (cma_create() and cma_free()) that allow creating and freeing,
> respectively, CMA regions dynamically at runtime.

I'm confused. We still allow cma_create() only during __init, right?

Would we expect callers of cma_free() after __init? Or at which point?

> 
> The static array of CMA areas cannot be replaced by dynamically created
> areas because for many of them, allocation must not fail and some cases
> may need to initialize them before the slab allocator is even available.

We can start with a memblock array of an initial size (like we do today).

Then, when you need more space, we can double the size (copying content and
exchanging the pointer). Either allocate from memblock or from slab, if
available (slab_is_available).

memblock does something similar, see memblock_double_array().


-- 
Cheers,

David

Reply via email to