Skip to content

mm: hugetlb: fix CMA-related issues

Qi Zheng linux-mm lkml stable 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 1 replyIn review
  2. v43 patches 11 repliesSuperseded
  3. v33 patches 15 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v24 patches13 repliesSuperseded
v14 patches12 repliesSuperseded

Changes in v5 from the cover letter

- Move the HugeTLB CMA ownership check into cma_folio_is_longterm_pinnable(), keeping folio_is_longterm_pinnable() inline in mm.h without a HugeTLB header dependency. (suggested by David Hildenbrand)
- Clarify CMA ownership in the commit message for patch #2 (pointed by Muchun Song)
- Rebase onto next-20261116.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3x86: hugetlb: disable default CMA reservations on 32-bit kernelarch/x86/mm/hugetlbpage.c+1 -10 replies
2/3mm: gup: allow long-term pins of CMA-allocated HugeTLB foliosinclude/linux/cma.h include/linux/mm.h mm/cma.c+20 -31 reply
3/3mm: hugetlb: fix GFP mask propagation to CMAinclude/linux/cma.h mm/cma.c mm/hugetlb_cma.c+11 -50 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMuchun SongJose A. Perez de AzpillagaOscar SalvadorFrank van der LindenOscar Salvador (SUSE)David Hildenbrand (Arm)
1/3A-b R-b A-b
2/3A-b R-b R-b R-b R-b
3/3A-b R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v5 thread

Cover letter [PATCH v5 0/3] mm: hugetlb: fix CMA-related issues

From: Qi Zheng <[email protected]>

Hi all,

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.

Changes in v5:
- Move the HugeTLB CMA ownership check into cma_folio_is_longterm_pinnable(), keeping folio_is_longterm_pinnable() inline in mm.h without a HugeTLB header dependency. (suggested by David Hildenbrand)
- Clarify CMA ownership in the commit message for patch #2 (pointed by Muchun Song)
- Rebase onto next-20261116.

Changes in v4:
- add comment to cma_alloc_frozen_compound().
(suggested by Oscar Salvador)
- collect Reviewed-by tag.
- rebase onto next-20261110.

Changes in v3:
- Drop the cpuset fix. A more comprehensive fix across the HugeTLB allocation paths will follow in a separate patchset.
- Check for __GFP_COMP instead of adding it in cma_alloc_frozen_compound(), and leave __GFP_NOWARN to callers. (suggested by Oscar Salvador)
- Clarify the CMA ownership comment in folio_is_longterm_pinnable(). (suggested by Muchun Song)
- Collect Reviewed-by and Acked-by tags.

Changes in v2:
- Replace the PF_MEMALLOC_PIN allocation restriction with a GUP exception for HugeTLB folios marked HPG_cma. (suggested by Muchun Song)
- Pass the caller's GFP mask through cma_alloc_frozen_compound() instead of skipping CMA when direct reclaim is disallowed. (suggested by sashiko)
- Remove unnecessary revalidation of successfully allocated folios after cpuset changes. Retry only failed allocations.
(pointed by Jose A. Perez de Azpillaga)
- collect Reviewed-by and Acked-by.
- Rebase onto next-20261104.

Thanks,
Qi

Qi Zheng (3):
x86: hugetlb: disable default CMA reservations on 32-bit kernel
mm: gup: allow long-term pins of CMA-allocated HugeTLB folios
mm: hugetlb: fix GFP mask propagation to CMA

 arch/x86/mm/hugetlbpage.c |  2 +-
 include/linux/cma.h       |  5 ++++-
 include/linux/mm.h        |  9 ++++++---
 mm/cma.c                  | 21 +++++++++++++++++++--
 mm/hugetlb_cma.c          |  4 ++--
 5 files changed, 32 insertions(+), 9 deletions(-)

base-commit: 749a4de370409464cf8501ec5b2451df45c84eb4

Signature · 1 line
2.54.0