lkml.org 
[lkml]   [2007]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[05/17] More compound page features
Add a couple of more compound functions to avoid having to duplicate code in various places.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
include/linux/mm.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Index: linux-2.6.21-rc7/include/linux/mm.h
===================================================================
--- linux-2.6.21-rc7.orig/include/linux/mm.h 2007-04-24 11:33:34.000000000 -0700
+++ linux-2.6.21-rc7/include/linux/mm.h 2007-04-24 11:32:16.000000000 -0700
@@ -330,6 +330,21 @@ static inline int compound_order(struct
return (unsigned long)page[1].lru.prev;
}

+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
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-25 00:29    [from the cache]
©2003-2011 Jasper Spaans