From: Christoph Lameter Subject: Compound pages: Add compound_size() Add a function to determine the size of a compound page in bytes. Use that function a couple of places. Signed-off-by: Christoph Lameter --- arch/ia64/mm/init.c | 2 +- include/linux/mm.h | 5 +++++ mm/slub.c | 4 ++-- 3 files changed, 8 insertions(+), 3 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:30:36.150418347 -0700 +++ linux-2.6.25-rc5-mm1/include/linux/mm.h 2008-03-26 20:30:59.223406562 -0700 @@ -310,6 +310,11 @@ static inline int compound_pages(struct return 1 << compound_order(page); } +static inline int compound_size(struct page *page) +{ + return PAGE_SIZE << 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/arch/ia64/mm/init.c =================================================================== --- linux-2.6.25-rc5-mm1.orig/arch/ia64/mm/init.c 2008-03-26 20:31:36.507917648 -0700 +++ linux-2.6.25-rc5-mm1/arch/ia64/mm/init.c 2008-03-26 20:32:02.133417978 -0700 @@ -66,7 +66,7 @@ __ia64_sync_icache_dcache (pte_t pte) if (test_bit(PG_arch_1, &page->flags)) return; /* i-cache is already coherent with d-cache */ - flush_icache_range(addr, addr + (PAGE_SIZE << compound_order(page))); + flush_icache_range(addr, addr + compound_size(page)); set_bit(PG_arch_1, &page->flags); /* mark page as clean */ } Index: linux-2.6.25-rc5-mm1/mm/slub.c =================================================================== --- linux-2.6.25-rc5-mm1.orig/mm/slub.c 2008-03-26 20:32:15.056668565 -0700 +++ linux-2.6.25-rc5-mm1/mm/slub.c 2008-03-26 20:33:00.549167339 -0700 @@ -650,7 +650,7 @@ static int slab_pad_check(struct kmem_ca return 1; start = page_address(page); - end = start + (PAGE_SIZE << compound_order(page)); + end = start + compound_size(page); length = slab_objects(s, page) * s->size; remainder = end - (start + length); if (!remainder) @@ -2636,7 +2636,7 @@ size_t ksize(const void *object) page = virt_to_head_page(object); if (unlikely(!PageSlab(page))) - return PAGE_SIZE << compound_order(page); + return compound_size(page); s = page->slab;