From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: akpm@linux-foundation.org, songmuchun@bytedance.com,
mike.kravetz@oracle.com, willy@infradead.org,
almasrymina@google.com, linmiaohe@huawei.com,
minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com,
Sidhartha Kumar <sidhartha.kumar@oracle.com>
Subject: [PATCH 1/9] mm/hugetlb_cgroup: convert __set_hugetlb_cgroup() to folios
Date: Thu, 13 Oct 2022 20:12:55 -0700 [thread overview]
Message-ID: <20221014031303.231740-2-sidhartha.kumar@oracle.com> (raw)
In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com>
Change __set_hugetlb_cgroup() to use folios so it is explicit that the
function operates on a head page.
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
---
include/linux/hugetlb_cgroup.h | 14 +++++++-------
mm/hugetlb_cgroup.c | 4 ++--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h
index 630cd255d0cf..7576e9ed8afe 100644
--- a/include/linux/hugetlb_cgroup.h
+++ b/include/linux/hugetlb_cgroup.h
@@ -90,31 +90,31 @@ hugetlb_cgroup_from_page_rsvd(struct page *page)
return __hugetlb_cgroup_from_page(page, true);
}
-static inline void __set_hugetlb_cgroup(struct page *page,
+static inline void __set_hugetlb_cgroup(struct folio *folio,
struct hugetlb_cgroup *h_cg, bool rsvd)
{
- VM_BUG_ON_PAGE(!PageHuge(page), page);
+ VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio);
- if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER)
+ if (folio_order(folio) < HUGETLB_CGROUP_MIN_ORDER)
return;
if (rsvd)
- set_page_private(page + SUBPAGE_INDEX_CGROUP_RSVD,
+ set_page_private(folio_page(folio, SUBPAGE_INDEX_CGROUP_RSVD),
(unsigned long)h_cg);
else
- set_page_private(page + SUBPAGE_INDEX_CGROUP,
+ set_page_private(folio_page(folio, SUBPAGE_INDEX_CGROUP),
(unsigned long)h_cg);
}
static inline void set_hugetlb_cgroup(struct page *page,
struct hugetlb_cgroup *h_cg)
{
- __set_hugetlb_cgroup(page, h_cg, false);
+ __set_hugetlb_cgroup(page_folio(page), h_cg, false);
}
static inline void set_hugetlb_cgroup_rsvd(struct page *page,
struct hugetlb_cgroup *h_cg)
{
- __set_hugetlb_cgroup(page, h_cg, true);
+ __set_hugetlb_cgroup(page_folio(page), h_cg, true);
}
static inline bool hugetlb_cgroup_disabled(void)
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
index c86691c431fd..81675f8f44e9 100644
--- a/mm/hugetlb_cgroup.c
+++ b/mm/hugetlb_cgroup.c
@@ -317,7 +317,7 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages,
if (hugetlb_cgroup_disabled() || !h_cg)
return;
- __set_hugetlb_cgroup(page, h_cg, rsvd);
+ __set_hugetlb_cgroup(page_folio(page), h_cg, rsvd);
if (!rsvd) {
unsigned long usage =
h_cg->nodeinfo[page_to_nid(page)]->usage[idx];
@@ -359,7 +359,7 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages,
h_cg = __hugetlb_cgroup_from_page(page, rsvd);
if (unlikely(!h_cg))
return;
- __set_hugetlb_cgroup(page, NULL, rsvd);
+ __set_hugetlb_cgroup(page_folio(page), NULL, rsvd);
page_counter_uncharge(__hugetlb_cgroup_counter_from_cgroup(h_cg, idx,
rsvd),
--
2.31.1
next prev parent reply other threads:[~2022-10-14 3:13 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 3:12 [PATCH 0/9] convert hugetlb_cgroup helper functions " Sidhartha Kumar
2022-10-14 3:12 ` Sidhartha Kumar [this message]
2022-10-31 14:51 ` [PATCH 1/9] mm/hugetlb_cgroup: convert __set_hugetlb_cgroup() " Mike Kravetz
2022-10-14 3:12 ` [PATCH 2/9] mm/hugetlb_cgroup: convert hugetlb_cgroup_from_page() " Sidhartha Kumar
2022-10-31 16:13 ` Mike Kravetz
2022-11-01 16:40 ` Sidhartha Kumar
2022-10-14 3:12 ` [PATCH 3/9] mm/hugetlb_cgroup: convert set_hugetlb_cgroup*() " Sidhartha Kumar
2022-10-31 16:38 ` Mike Kravetz
2022-11-01 16:43 ` Sidhartha Kumar
2022-10-14 3:12 ` [PATCH 4/9] mm/hugetlb_cgroup: convert hugetlb_cgroup_migrate " Sidhartha Kumar
2022-10-31 16:50 ` Mike Kravetz
2022-10-14 3:12 ` [PATCH 5/9] mm/hugetlb: convert isolate_or_dissolve_huge_page " Sidhartha Kumar
2022-10-31 19:37 ` Mike Kravetz
2022-10-14 3:13 ` [PATCH 6/9] mm/hugetlb: convert free_huge_page " Sidhartha Kumar
2022-10-17 20:36 ` Andrew Morton
2022-10-31 19:44 ` Mike Kravetz
2022-10-14 3:13 ` [PATCH 7/9] mm/hugetlb_cgroup: convert hugetlb_cgroup_uncharge_page() " Sidhartha Kumar
2022-10-31 20:11 ` Mike Kravetz
2022-10-14 3:13 ` [PATCH 8/9] mm/hugeltb_cgroup: convert hugetlb_cgroup_commit_charge*() " Sidhartha Kumar
2022-10-31 20:22 ` Mike Kravetz
2022-10-14 3:13 ` [PATCH 9/9] mm/hugetlb: convert move_hugetlb_state() " Sidhartha Kumar
2022-10-31 20:56 ` Mike Kravetz
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=20221014031303.231740-2-sidhartha.kumar@oracle.com \
--to=sidhartha.kumar@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=almasrymina@google.com \
--cc=aneesh.kumar@linux.ibm.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=minhquangbui99@gmail.com \
--cc=songmuchun@bytedance.com \
--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