From 6a89d3578cf5d3dc9ade6f648b83c53796642d3f Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 25 Jul 2007 20:05:37 -0700 Subject: [PATCH] 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 file changed, 15 insertions(+) Index: linux-2.6/include/linux/mm.h =================================================================== --- linux-2.6.orig/include/linux/mm.h 2008-02-16 20:34:56.000000000 -0800 +++ linux-2.6/include/linux/mm.h 2008-02-16 20:35:11.000000000 -0800 @@ -318,6 +318,21 @@ static inline void set_compound_order(st compound_nth_page(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