diff options
author | Matthew Wilcox (Oracle) <[email protected]> | 2020-08-14 17:30:40 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2020-08-14 19:56:56 -0700 |
commit | 2be1d71841b7ecfb01ce4c59f6e1d082c3c18a8a (patch) | |
tree | 634b35d83ad5d2c7e439271dd42ee6f197d0df2d | |
parent | 6c357848b44b4016ca422178aa368a7472245f6f (diff) |
mm: add thp_head
This is like compound_head() but compiles away when
CONFIG_TRANSPARENT_HUGEPAGE is not enabled.
Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: William Kucharski <[email protected]>
Reviewed-by: Zi Yan <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | include/linux/huge_mm.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 229f986d535a..8a8bc46a2432 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -260,6 +260,15 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, } /** + * thp_head - Head page of a transparent huge page. + * @page: Any page (tail, head or regular) found in the page cache. + */ +static inline struct page *thp_head(struct page *page) +{ + return compound_head(page); +} + +/** * thp_order - Order of a transparent huge page. * @page: Head page of a transparent huge page. */ @@ -335,6 +344,12 @@ static inline struct list_head *page_deferred_list(struct page *page) #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) +static inline struct page *thp_head(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + return page; +} + static inline unsigned int thp_order(struct page *page) { VM_BUG_ON_PGFLAGS(PageTail(page), page); |