diff mbox series

[v2,08/25] mm: Introduce thp_order

Message ID 20200212041845.25879-9-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Large pages in the page cache | expand

Commit Message

Matthew Wilcox Feb. 12, 2020, 4:18 a.m. UTC
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

Like compound_order() except 0 when THP is disabled.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/huge_mm.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kirill A . Shutemov Feb. 13, 2020, 2:20 p.m. UTC | #1
On Tue, Feb 11, 2020 at 08:18:28PM -0800, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> 
> Like compound_order() except 0 when THP is disabled.

Again, functions are preferred if an option.
diff mbox series

Patch

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)
 {