From: Christoph Lameter Subject: Replace PageCompound with PageTail in put_page() PageCompound may require checking of two flags (PageTail, PageHead) to be set which is more costly then simply checking the tail bit. If put_page() is called for a tail page then put_compound_page() will figure out the head page and call destroy_compound_page(). [The tail case is a strange use case. It may be better to remove that special case from swap.c at some point. If a struct page pointer to a tail page is used then the caller could have manipulated the page state of a tail page. But compound page states are kept in the head page!] If put_page is used on a head page then we can directly decrement the refcount and proceed to __page_cache_release only if the refcount reached zero. __page_cache_release which will call __free_one_page(). __free_one_page will then also call destroy_compound_page() if it discovers that the page struct passed to it points to a head page. There is no need to invoke the logic to determine the head page (compound_head()) for that case. Signed-off-by: Christoph Lameter --- mm/swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6.25-rc8-mm1/mm/swap.c =================================================================== --- linux-2.6.25-rc8-mm1.orig/mm/swap.c 2008-04-03 16:36:44.120461859 -0700 +++ linux-2.6.25-rc8-mm1/mm/swap.c 2008-04-03 16:37:08.608643077 -0700 @@ -70,7 +70,7 @@ static void put_compound_page(struct pag void put_page(struct page *page) { - if (unlikely(PageCompound(page))) + if (unlikely(PageTail(page))) put_compound_page(page); else if (put_page_testzero(page)) __page_cache_release(page);