From: Enze Li <lienze@kylinos.cn>
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] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio()
Date: Tue, 27 Oct 2026 14:04:46 +0800 [thread overview]
Message-ID: <20261027060446.289404-1-lienze@kylinos.cn> (raw)
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
next reply other threads:[~2026-10-27 6:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 6:04 Enze Li [this message]
2026-10-27 6:26 ` [PATCH] mm/hugetlb: use account_new_hugetlb_folio() in add_hugetlb_folio() 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)
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=20261027060446.289404-1-lienze@kylinos.cn \
--to=lienze@kylinos.cn \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--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