Subject: Use PageTail instead of PageCompound in release_pages() We only need to call put_compound_page() directly if the page struct is pointing to a tail page. A head page can be put on the pagevec. free_hot_cold_page() will --- mm/page_alloc.c | 10 ++++++++-- mm/swap.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) Index: linux-2.6.25-rc8-mm1/mm/swap.c =================================================================== --- linux-2.6.25-rc8-mm1.orig/mm/swap.c 2008-04-03 16:07:24.909597652 -0700 +++ linux-2.6.25-rc8-mm1/mm/swap.c 2008-04-03 16:08:26.090359318 -0700 @@ -293,7 +293,7 @@ void release_pages(struct page **pages, for (i = 0; i < nr; i++) { struct page *page = pages[i]; - if (unlikely(PageCompound(page))) { + if (unlikely(PageTail(page))) { if (zone) { spin_unlock_irqrestore(&zone->lru_lock, flags); zone = NULL; Index: linux-2.6.25-rc8-mm1/mm/page_alloc.c =================================================================== --- linux-2.6.25-rc8-mm1.orig/mm/page_alloc.c 2008-04-03 16:12:26.061238779 -0700 +++ linux-2.6.25-rc8-mm1/mm/page_alloc.c 2008-04-03 16:17:06.556113648 -0700 @@ -1775,8 +1775,14 @@ void __pagevec_free(struct pagevec *pvec { int i = pagevec_count(pvec); - while (--i >= 0) - free_hot_cold_page(pvec->pages[i], pvec->cold); + while (--i >= 0) { + struct page *page = pvec->pages[i]; + + if (unlikely(PageHead(page))) + get_compound_page_dtor(page)(page); + else + free_hot_cold_page(page, pvec->cold); + } } void __free_pages(struct page *page, unsigned int order)