Skip to content

Subject: [PATCH v3 0/4] mm/hugetlb: Fix CMA parsing, flags and usage accounting

Kaitao Cheng cgroups linux-mm lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest4 patches 2 repliesIn review
  2. v23 patches 4 repliesSuperseded
  3. v13 patches 7 repliesSuperseded

Changes in v3 from the cover letter

- Retain patch 3/3 from v1.
- Fix code alignment.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mm/hugetlb_cma: fix incorrect hugetlb_cma_size assignment on malformed inputmm/hugetlb_cma.c+3 -00 replies
2/4mm/hugetlb: Preserve persistent flags when returning folios to the poolmm/hugetlb.c+7 -30 replies
3/4mm/hugetlb: fix NR_HUGETLB accounting for unused surplus foliosmm/hugetlb.c+7 -11 reply
4/4mm/hugetlb: Account NR_HUGETLB at folio state transitionsmm/hugetlb.c mm/memcontrol.c+29 -270 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchMuchun SongOscar SalvadorZi YanQi Zheng
1/4A-b R-b
2/4A-b A-b A-b
3/4A-b
4/4

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

Read the v3 thread

Cover letter [PATCH v3 0/4] Subject: [PATCH v3 0/4] mm/hugetlb: Fix CMA parsing, flags and usage accounting

From: Kaitao Cheng <[email protected]>

This series fixes three independent HugeTLB issues reported by Sashiko and includes a follow-up cleanup of NR_HUGETLB accounting.

Patch 1 rejects a global hugetlb_cma size following node-specific entries. This prevents malformed input from overwriting valid per-node reservations with an incorrectly parsed global size.

Patch 2 preserves persistent folio flags when a failed vmemmap restore returns a folio to the pool. This retains CMA allocation tracking and raw hardware poison information, while ensuring transient flags are cleared before returning the folio.

Patch 3 retains the minimal NR_HUGETLB accounting fix, as suggested by Muchun Song, to keep it straightforward to backport. It balances the counter before freeing unused surplus folios during reservation gathering or after a failed overcommit recheck.

Patch 4 moves NR_HUGETLB node accounting to the underlying folio state transitions and separates it from memcg statistics. This cleans up the accounting in the allocation and surplus cleanup paths.

Changes in v3:
- Retain patch 3/3 from v1.
- Fix code alignment.

Changes in v2:
- Patch 2: Preserve persistent flags, clear transient flags, and warn about unexpected flags.
- Patch 3: Account at folio state transitions and separate node and memcg statistics.

Link to v2:
https://lore.kernel.org/all/[email protected]/

Link to v1:
https://lore.kernel.org/all/[email protected]/

Kaitao Cheng (4):
mm/hugetlb_cma: fix incorrect hugetlb_cma_size assignment on malformed
input
mm/hugetlb: Preserve persistent flags when returning folios to the
pool
mm/hugetlb: fix NR_HUGETLB accounting for unused surplus folios mm/hugetlb: Account NR_HUGETLB at folio state transitions

 mm/hugetlb.c     | 52 +++++++++++++++++++++++++++++++-----------------
 mm/hugetlb_cma.c |  3 +++
 mm/memcontrol.c  |  6 +-----
 3 files changed, 38 insertions(+), 23 deletions(-)
Signature · 1 line
2.53.0