Re: CMA, memdescs and folios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27.02.24 23:02, Matthew Wilcox wrote:
It may be helpful to look at

https://kernelnewbies.org/MatthewWilcox/Memdescs

I don't yet have a plan for what CMA should look like in the memdesc
future.  Partly I just don't know CMA very well.  Some help would
be appreciated ...

First, I'm pretty sure that cma allocations are freed as a single
unit; there's no intended support for "allocate 2000MB from CMA, free
500MB-1500MB, use the first 500MB for one thing and the last 500MB for
something else".  Right?

hugetlb uses CMA to allocate gigantic folios.

I think we can demote them (e.g., 1 GiB -> 512 x 2 MiB), and then free individual demoted (is that a word?) folios back via CMA.

At least, there is a comment in __update_and_free_hugetlb_folio():

"Non-gigantic pages demoted from CMA allocated gigantic pages need to be given back to CMA in free_gigantic_folio."


And in fact, hugetlb_cma_reserve() prepares exactly for that: it sets the CMA granularity to the smallest folio size we could get after demoting.

"Note that 'order per bit' is based on smallest size that may be returned to CMA allocator in the case of huge page demotion."

I suspect there are other such users that free in different granularity than they allocated.

--
Cheers,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux