From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id 7C2476B0260 for ; Fri, 15 Apr 2016 04:59:42 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id w143so12899183wmw.2 for ; Fri, 15 Apr 2016 01:59:42 -0700 (PDT) Received: from outbound-smtp12.blacknight.com (outbound-smtp12.blacknight.com. [46.22.139.17]) by mx.google.com with ESMTPS id ma2si17505450wjb.145.2016.04.15.01.59.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2016 01:59:41 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp12.blacknight.com (Postfix) with ESMTPS id F322B1C195E for ; Fri, 15 Apr 2016 09:59:40 +0100 (IST) From: Mel Gorman Subject: [PATCH 01/28] mm, page_alloc: Only check PageCompound for high-order pages Date: Fri, 15 Apr 2016 09:58:53 +0100 Message-Id: <1460710760-32601-2-git-send-email-mgorman@techsingularity.net> In-Reply-To: <1460710760-32601-1-git-send-email-mgorman@techsingularity.net> References: <1460710760-32601-1-git-send-email-mgorman@techsingularity.net> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Vlastimil Babka , Jesper Dangaard Brouer , Linux-MM , LKML , Mel Gorman order-0 pages by definition cannot be compound so avoid the check in the fast path for those pages. Signed-off-by: Mel Gorman --- mm/page_alloc.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 59de90d5d3a3..5d205bcfe10d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1024,24 +1024,33 @@ void __meminit reserve_bootmem_region(unsigned long start, unsigned long end) static bool free_pages_prepare(struct page *page, unsigned int order) { - bool compound = PageCompound(page); - int i, bad = 0; + int bad = 0; VM_BUG_ON_PAGE(PageTail(page), page); - VM_BUG_ON_PAGE(compound && compound_order(page) != order, page); trace_mm_page_free(page, order); kmemcheck_free_shadow(page, order); kasan_free_pages(page, order); + /* + * Check tail pages before head page information is cleared to + * avoid checking PageCompound for order-0 pages. + */ + if (order) { + bool compound = PageCompound(page); + int i; + + VM_BUG_ON_PAGE(compound && compound_order(page) != order, page); + + for (i = 1; i < (1 << order); i++) { + if (compound) + bad += free_tail_pages_check(page, page + i); + bad += free_pages_check(page + i); + } + } if (PageAnon(page)) page->mapping = NULL; bad += free_pages_check(page); - for (i = 1; i < (1 << order); i++) { - if (compound) - bad += free_tail_pages_check(page, page + i); - bad += free_pages_check(page + i); - } if (bad) return false; -- 2.6.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org