Re: [PATCH 4/5] mm: hugetlb: avoid recursive CMA allocation during migration
From: Jose A. Perez de Azpillaga
Date: Sat Oct 17 2026 - 14:54:30 EST
On 10/16/26 12:07 PM, Qi Zheng wrote:
> From: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
>
> Contiguous allocation can migrate allocated HugeTLB folios or replace free
> HugeTLB folios while holding a CMA allocation mutex. Allocating a
> replacement through CMA would recurse into that allocation path once
> non-gigantic HugeTLB pages can use CMA.
>
> Add a fresh allocation helper that bypasses CMA, and use it for free folio
> replacement. Pass an explicit allow_cma argument through the migration
> allocation API and disable it for MR_CONTIG_RANGE. Honor hugetlb_cma_only
> by failing fresh allocation when the corresponding size requires CMA.
>
> The existing gigantic migration restriction is unchanged.
>
> Assisted-by: LLM
> Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
[snip]
> /*
> - * Common helper to allocate a fresh hugetlb folio. All specific allocators
> - * should use this function to get new hugetlb folio
> + * Common helper to allocate a fresh hugetlb folio.
couldn't allow_cma be passed down to alloc_fresh_hugetlb_folio() instead
of adding a second copy of it, so this line can stay?
--
cheers,
jose a. p-a