* [PATCH v2] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
@ 2026-11-28 13:39 Enze Li
0 siblings, 0 replies; only message in thread
From: Enze Li @ 2026-11-28 13:39 UTC (permalink / raw)
To: muchun.song, osalvador, david, akpm; +Cc: linux-mm, Enze Li
From: Enze Li <lienze@kylinos.cn>
Every other place that accounts a new huge page already calls
account_new_hugetlb_folio(), and add_hugetlb_folio() was the odd one
out, still open-coding the same two increments. Swap it over.
The helper is defined further down the file, so add a forward
declaration for it.
No functional change intended.
Reviewed-by: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Enze Li <lienze@kylinos.cn>
---
v2:
Resend now that David's fix (commit 51154a62373b, "mm/hugetlb:account
temporary folios separately") has landed, as discussed in v1 [1].
Rebased on top of mm-new.
[1] https://lore.kernel.org/linux-mm/20261027060446.289404-1-lienze@kylinos.cn/
mm/hugetlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4386425b5ce5..92cfcd469813 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -142,6 +142,7 @@ static void hugetlb_unmap_range(struct mmu_gather *tlb,
unsigned long end, struct folio *folio,
zap_flags_t zap_flags);
static struct resv_map *vma_resv_map(struct vm_area_struct *vma);
+static void account_new_hugetlb_folio(struct hstate *h, struct folio *folio);
static inline bool subpool_is_free(struct hugepage_subpool *spool)
{
@@ -1489,8 +1490,7 @@ void add_hugetlb_folio(struct hstate *h, struct folio *folio,
BIT(HPG_cma)), folio);
INIT_LIST_HEAD(&folio->lru);
- h->nr_huge_pages++;
- h->nr_huge_pages_node[nid]++;
+ account_new_hugetlb_folio(h, folio);
if (adjust_surplus) {
h->surplus_huge_pages++;
--
2.53.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-28 13:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 13:39 [PATCH v2] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio() Enze Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox