[PATCH v2 08/25] mm: Introduce thp_order
From: Matthew Wilcox
Date: Tue Feb 11 2020 - 23:19:17 EST
From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx>
Like compound_order() except 0 when THP is disabled.
Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
include/linux/huge_mm.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 3680ae2d9019..3de788ee25bd 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -233,6 +233,7 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
#define hpage_nr_pages(page) (long)compound_nr(page)
#define thp_size(page) page_size(page)
+#define thp_order(page) compound_order(page)
struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
pmd_t *pmd, int flags, struct dev_pagemap **pgmap);
@@ -288,6 +289,7 @@ static inline struct list_head *page_deferred_list(struct page *page)
#define hpage_nr_pages(x) 1L
#define thp_size(x) PAGE_SIZE
+#define thp_order(x) 0U
static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
{
--
2.25.0