From: Enze Li <enze.li@linux.dev>
To: muchun.song@linux.dev, osalvador@suse.de, david@kernel.org,
akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Enze Li <lienze@kylinos.cn>
Subject: [PATCH v2] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
Date: Sat, 28 Nov 2026 21:39:54 +0800 [thread overview]
Message-ID: <20261128133954.87349-1-enze.li@linux.dev> (raw)
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
reply other threads:[~2026-11-28 13:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261128133954.87349-1-enze.li@linux.dev \
--to=enze.li@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=lienze@kylinos.cn \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox