Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
@ 2026-10-27  6:04 Enze Li
  2026-10-27  6:26 ` Muchun Song
  2026-10-27  9:03 ` David Hildenbrand (Arm)
  0 siblings, 2 replies; 5+ messages in thread
From: Enze Li @ 2026-10-27  6:04 UTC (permalink / raw)
  To: muchun.song, osalvador, david, akpm; +Cc: linux-mm, Enze Li

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.

Signed-off-by: Enze Li <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 4a008afaedf9..a8d162449daa 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)
 {
@@ -1444,8 +1445,7 @@ void add_hugetlb_folio(struct hstate *h, struct folio *folio,
 	lockdep_assert_held(&hugetlb_lock);
 
 	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++;

base-commit: bae9a042b03b27924c6fd5bdc00a20d6a44d6041
-- 
2.56.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-27 10:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27  6:04 [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio() Enze Li
2026-10-27  6:26 ` Muchun Song
2026-10-27  9:03 ` David Hildenbrand (Arm)
2026-10-27 10:01   ` Enze Li
2026-10-27 10:49     ` David Hildenbrand (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox