From: Christoph Lameter <clameter@sgi.com>
Subject: Compound pages: Add compound_pages().

Add another function to determine the number of base pages in a compound page.

Use that function in SLAB and SLUB.

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

---
 include/linux/mm.h |    5 +++++
 mm/slab.c          |    2 +-
 mm/slub.c          |    2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.25-rc5-mm1/include/linux/mm.h
===================================================================
--- linux-2.6.25-rc5-mm1.orig/include/linux/mm.h	2008-03-26 20:28:01.136668470 -0700
+++ linux-2.6.25-rc5-mm1/include/linux/mm.h	2008-03-26 20:28:37.479371615 -0700
@@ -305,6 +305,11 @@ 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 void set_compound_order(struct page *page, unsigned long order)
 {
 	page[1].lru.prev = (void *)order;
Index: linux-2.6.25-rc5-mm1/mm/slab.c
===================================================================
--- linux-2.6.25-rc5-mm1.orig/mm/slab.c	2008-03-26 20:29:11.177918038 -0700
+++ linux-2.6.25-rc5-mm1/mm/slab.c	2008-03-26 20:29:35.018747279 -0700
@@ -2742,7 +2742,7 @@ static void slab_map_pages(struct kmem_c
 
 	page = virt_to_page(addr);
 
-	nr_pages = 1 << compound_order(page);
+	nr_pages = compound_pages(page);
 	do {
 		page_set_cache(page, cache);
 		page_set_slab(page, slab);
Index: linux-2.6.25-rc5-mm1/mm/slub.c
===================================================================
--- linux-2.6.25-rc5-mm1.orig/mm/slub.c	2008-03-26 20:29:37.460418803 -0700
+++ linux-2.6.25-rc5-mm1/mm/slub.c	2008-03-26 20:30:04.360149559 -0700
@@ -1044,7 +1044,7 @@ static struct page *allocate_slab(struct
 		 */
 		page = alloc_slab_page(flags, node, get_order(s->size));
 		if (page) {
-			pages = 1 << compound_order(page);
+			pages = compound_pages(page);
 			stat(get_cpu_slab(s, raw_smp_processor_id()),
 							ORDER_FALLBACK);
 		} else