Skip to content

Commit 2be1d71

Browse files
Matthew Wilcox (Oracle)torvalds
authored andcommitted
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]>
1 parent 6c35784 commit 2be1d71

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/linux/huge_mm.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
259259
return NULL;
260260
}
261261

262+
/**
263+
* thp_head - Head page of a transparent huge page.
264+
* @page: Any page (tail, head or regular) found in the page cache.
265+
*/
266+
static inline struct page *thp_head(struct page *page)
267+
{
268+
return compound_head(page);
269+
}
270+
262271
/**
263272
* thp_order - Order of a transparent huge page.
264273
* @page: Head page of a transparent huge page.
@@ -335,6 +344,12 @@ static inline struct list_head *page_deferred_list(struct page *page)
335344
#define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
336345
#define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
337346

347+
static inline struct page *thp_head(struct page *page)
348+
{
349+
VM_BUG_ON_PGFLAGS(PageTail(page), page);
350+
return page;
351+
}
352+
338353
static inline unsigned int thp_order(struct page *page)
339354
{
340355
VM_BUG_ON_PGFLAGS(PageTail(page), page);

0 commit comments

Comments
 (0)