Re: [PATCH v5 0/3] mm: hugetlb: fix CMA-related issues
From: Andrew Morton
Date: Thu Nov 19 2026 - 03:43:45 EST
On Tue, 17 Nov 2026 17:33:56 +0800 Qi Zheng <qi.zheng@xxxxxxxxx> wrote:
> This series fixes three CMA-related issues in HugeTLB reservation,
> long-term pinning and allocation:
>
> - Avoid ineffective CMA reservations on 32-bit x86 kernels running on
> CPUs that advertise 1 GiB page support.
> - Allow long-term pins of explicitly CMA-allocated HugeTLB folios,
> which already own the CMA memory.
> - Preserve the caller's GFP mask when allocating from CMA.
I fed this into LLM-driven testbot, both confirmatory and adversarial
testing. All looks good.
Tested-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
: Tested the three-patch mm: hugetlb: fix CMA-related issues v5
: series before and after applying it. The 32-bit boots covered non-PAE
: and PAE kernels. The 64-bit tests used a two-node VM with 12 GiB of
: RAM and CMA-backed 1 GiB HugeTLB pages.
:
: 1. x86: hugetlb: disable default CMA reservations on 32-bit kernel
:
: Without the series, non-PAE boot warned and reserved an unusable
: 64 MiB CMA area. A PAE boot also reserved an unusable 1 GiB area.
: With the series, both kernels rejected hugetlb_cma= and reserved
: neither area.
:
: 2. mm: gup: allow long-term pins of CMA-allocated HugeTLB folios
:
: A long-term pin of a HugeTLB page allocated from CMA failed with
: ENOMEM before the series and succeeded afterward. As a negative
: control, I found an ordinary anonymous page inside CMA on each
: kernel. Long-term pinning migrated it out of CMA before succeeding
: on both. The change did not permit pinning that borrowed page in
: place.
:
: 3. mm: hugetlb: fix GFP mask propagation to CMA
:
: On a preferred-node allocation, the caller cleared
: __GFP_DIRECT_RECLAIM. CMA received it set before the series and
: clear afterward. I then exhausted node 0's CMA area: further 1 GiB
: pages fell back to node 1 on both kernels, and a fourth fault raised
: SIGBUS after both areas were full. The fallback's reclaim-enabled
: mask reached CMA on both kernels.
:
: Allocation latency and general memory-pressure behavior were not
: measured.