From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Muchun Song <songmuchun@bytedance.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Bui Quang Minh <minhquangbui99@gmail.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Miaohe Lin <linmiaohe@huawei.com>,
Mina Almasry <almasrymina@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1.y 2/4] mm/hugetlb_cgroup: convert hugetlb_cgroup_migrate to folios
Date: Tue, 10 Nov 2026 09:34:17 -0500 [thread overview]
Message-ID: <20261110143410.1902001-2-sashal@kernel.org> (raw)
In-Reply-To: <20261110143410.1902001-1-sashal@kernel.org>
From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
[ Upstream commit 29f394304f624b06fafb3cc9c3da8779f71f4bee ]
Cleans up intermediate page to folio conversion code in
hugetlb_cgroup_migrate() by changing its arguments from pages to folios.
Link: https://lkml.kernel.org/r/20221101223059.460937-5-sidhartha.kumar@oracle.com
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Bui Quang Minh <minhquangbui99@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Mina Almasry <almasrymina@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: 23fac055c211 ("mm/hugetlb_cgroup: move per-node usage on cgroup reparenting")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/hugetlb_cgroup.h | 8 ++++----
mm/hugetlb.c | 2 +-
mm/hugetlb_cgroup.c | 8 +++-----
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index f0d9f295413be..c70f92fe493ef 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -177,8 +177,8 @@ extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
bool region_del);
extern void hugetlb_cgroup_file_init(void) __init;
-extern void hugetlb_cgroup_migrate(struct page *oldhpage,
- struct page *newhpage);
+extern void hugetlb_cgroup_migrate(struct folio *old_folio,
+ struct folio *new_folio);
#else
static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
@@ -286,8 +286,8 @@ static inline void hugetlb_cgroup_file_init(void)
{
}
-static inline void hugetlb_cgroup_migrate(struct page *oldhpage,
- struct page *newhpage)
+static inline void hugetlb_cgroup_migrate(struct folio *old_folio,
+ struct folio *new_folio)
{
}
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 89c82bdf2f217..76da1d9650bd4 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7545,7 +7545,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason)
{
struct hstate *h = page_hstate(oldpage);
- hugetlb_cgroup_migrate(oldpage, newpage);
+ hugetlb_cgroup_migrate(page_folio(oldpage), page_folio(newpage));
set_page_owner_migrate_reason(newpage, reason);
/*
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
index 001828b062d43..4cd57f979245f 100644
--- a/mm/hugetlb_cgroup.c
+++ b/mm/hugetlb_cgroup.c
@@ -884,13 +884,11 @@ void __init hugetlb_cgroup_file_init(void)
* hugetlb_lock will make sure a parallel cgroup rmdir won't happen
* when we migrate hugepages
*/
-void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage)
+void hugetlb_cgroup_migrate(struct folio *old_folio, struct folio *new_folio)
{
struct hugetlb_cgroup *h_cg;
struct hugetlb_cgroup *h_cg_rsvd;
- struct hstate *h = page_hstate(oldhpage);
- struct folio *old_folio = page_folio(oldhpage);
- struct folio *new_folio = page_folio(newhpage);
+ struct hstate *h = folio_hstate(old_folio);
if (hugetlb_cgroup_disabled())
return;
@@ -904,7 +902,7 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage)
/* move the h_cg details to new cgroup */
set_hugetlb_cgroup(new_folio, h_cg);
set_hugetlb_cgroup_rsvd(new_folio, h_cg_rsvd);
- list_move(&newhpage->lru, &h->hugepage_activelist);
+ list_move(&new_folio->lru, &h->hugepage_activelist);
spin_unlock_irq(&hugetlb_lock);
return;
}
--
2.53.0
next prev parent reply other threads:[~2026-11-10 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 10:47 FAILED: patch "[PATCH] mm/hugetlb_cgroup: move per-node usage on cgroup reparenting" failed to apply to 6.1-stable tree Sasha Levin
2026-11-10 14:34 ` [PATCH 6.1.y 1/4] mm/hugetlb_cgroup: convert set_hugetlb_cgroup*() to folios Sasha Levin
2026-11-10 14:34 ` Sasha Levin [this message]
2026-11-10 14:34 ` [PATCH 6.1.y 3/4] mm/hugetlb_cgroup: move per-node usage on cross node migration Sasha Levin
2026-11-10 14:34 ` [PATCH 6.1.y 4/4] mm/hugetlb_cgroup: move per-node usage on cgroup reparenting Sasha Levin
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=20261110143410.1902001-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=linmiaohe@huawei.com \
--cc=mike.kravetz@oracle.com \
--cc=minhquangbui99@gmail.com \
--cc=sidhartha.kumar@oracle.com \
--cc=songmuchun@bytedance.com \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.org \
/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