Skip to content

Commit 6ffbb45

Browse files
Matthew Wilcox (Oracle)torvalds
authored andcommitted
mm: add thp_order
This function returns the order of a transparent huge page. It compiles to 0 if CONFIG_TRANSPARENT_HUGEPAGE is disabled. 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 4190156 commit 6ffbb45

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

include/linux/huge_mm.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,19 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
258258
else
259259
return NULL;
260260
}
261+
262+
/**
263+
* thp_order - Order of a transparent huge page.
264+
* @page: Head page of a transparent huge page.
265+
*/
266+
static inline unsigned int thp_order(struct page *page)
267+
{
268+
VM_BUG_ON_PGFLAGS(PageTail(page), page);
269+
if (PageHead(page))
270+
return HPAGE_PMD_ORDER;
271+
return 0;
272+
}
273+
261274
static inline int hpage_nr_pages(struct page *page)
262275
{
263276
if (unlikely(PageTransHuge(page)))
@@ -317,6 +330,12 @@ static inline struct list_head *page_deferred_list(struct page *page)
317330
#define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
318331
#define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
319332

333+
static inline unsigned int thp_order(struct page *page)
334+
{
335+
VM_BUG_ON_PGFLAGS(PageTail(page), page);
336+
return 0;
337+
}
338+
320339
static inline int hpage_nr_pages(struct page *page)
321340
{
322341
VM_BUG_ON_PAGE(PageTail(page), page);

0 commit comments

Comments
 (0)