[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220829230014.384722-4-sidhartha.kumar@oracle.com>
Date: Mon, 29 Aug 2022 16:00:10 -0700
From: Sidhartha Kumar <sidhartha.kumar@...cle.com>
To: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: akpm@...ux-foundation.org, songmuchun@...edance.com,
mike.kravetz@...cle.com, willy@...radead.org, vbabka@...e.cz,
william.kucharski@...cle.com, dhowells@...hat.com,
peterx@...hat.com, arnd@...db.de, ccross@...gle.com,
hughd@...gle.com, ebiederm@...ssion.com,
Sidhartha Kumar <sidhartha.kumar@...cle.com>
Subject: [PATCH 3/7] mm/hugetlb: add hugetlb_folio_subpool() helper
Allows hugetlbfs_migrate_folio to check subpool information by passing in a
folio.
Signed-off-by: Sidhartha Kumar <sidhartha.kumar@...cle.com>
---
fs/hugetlbfs/inode.c | 4 ++--
include/linux/hugetlb.h | 7 ++++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 9326693c4987..d1a6384f426e 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -970,9 +970,9 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping,
if (rc != MIGRATEPAGE_SUCCESS)
return rc;
- if (hugetlb_page_subpool(&src->page)) {
+ if (hugetlb_folio_subpool(src)) {
hugetlb_set_page_subpool(&dst->page,
- hugetlb_page_subpool(&src->page));
+ hugetlb_folio_subpool(src));
hugetlb_set_page_subpool(&src->page, NULL);
}
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index c0a9bc9a6fa5..f6d5467c5ed8 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -709,12 +709,17 @@ extern unsigned int default_hstate_idx;
#define default_hstate (hstates[default_hstate_idx])
+static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio)
+{
+ return (void *)folio_get_private_1(folio);
+}
+
/*
* hugetlb page subpool pointer located in hpage[1].private
*/
static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage)
{
- return (void *)page_private(hpage + SUBPAGE_INDEX_SUBPOOL);
+ return hugetlb_folio_subpool(page_folio(hpage));
}
static inline void hugetlb_set_page_subpool(struct page *hpage,
--
2.31.1
Powered by blists - more mailing lists