aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorSidhartha Kumar <[email protected]>2022-09-22 10:42:07 -0500
committerAndrew Morton <[email protected]>2022-11-08 17:37:12 -0800
commite51da3a9b6c2f67879880259a25c51dbda01c462 (patch)
tree07aca1d7944489fd40fa52f8ef910520893cc568 /include/linux
parentece62684dcfb714b7d8452056b4a33d426b16457 (diff)
mm/hugetlb: add folio_hstate()
Helper function to retrieve hstate information from a hugetlb folio. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Sidhartha Kumar <[email protected]> Reported-by: kernel test robot <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Colin Cross <[email protected]> Cc: David Howells <[email protected]> Cc: "Eric W . Biederman" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Muchun Song <[email protected]> Cc: Peter Xu <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: William Kucharski <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hugetlb.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 496d02bdb997..20a0d5a08395 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -824,10 +824,15 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift,
}
#endif
+static inline struct hstate *folio_hstate(struct folio *folio)
+{
+ VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio);
+ return size_to_hstate(folio_size(folio));
+}
+
static inline struct hstate *page_hstate(struct page *page)
{
- VM_BUG_ON_PAGE(!PageHuge(page), page);
- return size_to_hstate(page_size(page));
+ return folio_hstate(page_folio(page));
}
static inline unsigned hstate_index_to_shift(unsigned index)
@@ -1036,6 +1041,11 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma)
return NULL;
}
+static inline struct hstate *folio_hstate(struct folio *folio)
+{
+ return NULL;
+}
+
static inline struct hstate *page_hstate(struct page *page)
{
return NULL;