From d02ad946be8eb773dd7c8329e2df91ec992d0452 Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 25 Jul 2007 20:05:37 -0700 Subject: [PATCH] compound_functions compound pages: Add new support functions compound_pages(page) -> Determines base pages of a compound page compound_shift(page) -> Determine the page shift of a compound page compound_size(page) -> Determine the size of a compound page Signed-off-by: Christoph Lameter --- include/linux/mm.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index c456c3a..3fea971 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -362,6 +362,21 @@ static inline void set_compound_order(struct page *page, unsigned long order) page[1].lru.prev = (void *)order; } +static inline int compound_pages(struct page *page) +{ + return 1 << compound_order(page); +} + +static inline int compound_shift(struct page *page) +{ + return PAGE_SHIFT + compound_order(page); +} + +static inline int compound_size(struct page *page) +{ + return PAGE_SIZE << compound_order(page); +} + /* * Multiple processes may "see" the same page. E.g. for untouched * mappings of /dev/null, all processes see the same page full of -- 1.4.4.4