lkml.org 
[lkml]   [2022]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/6] mm/hugetlb: add hugetlb_folio_subpool() helper
Date
Allows hugetlbfs_migrate_folio to check subpool information by passing
in a folio.

Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.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 52d9b390389b..c2e9c0cdbd81 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -1151,9 +1151,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 005cb8c76b84..3602e4cda31f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -744,12 +744,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
\
 
 \ /
  Last update: 2022-09-06 19:11    [W:0.068 / U:0.608 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site