summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2019-09-24 01:34:30 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-25 01:54:08 +0300
commitd8c6546b1aea843fbeb4d54a1202f1adda6504be (patch)
tree4b0fcc4a1afc9342472d59293b50fce20f2d70e7 /include
parent94ad9338109fe9d0b8a4a16828719dd6dcaee4c2 (diff)
downloadlinux-d8c6546b1aea843fbeb4d54a1202f1adda6504be.tar.xz
mm: introduce compound_nr()
Replace 1 << compound_order(page) with compound_nr(page). Minor improvements in readability. Link: http://lkml.kernel.org/r/20190721104612.19120-4-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9238548bdec5..69b7314c8d24 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -805,6 +805,12 @@ static inline void set_compound_order(struct page *page, unsigned int order)
page[1].compound_order = order;
}
+/* Returns the number of pages in this potentially compound page. */
+static inline unsigned long compound_nr(struct page *page)
+{
+ return 1UL << compound_order(page);
+}
+
/* Returns the number of bytes in this potentially compound page. */
static inline unsigned long page_size(struct page *page)
{