From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by kanga.kvack.org (Postfix) with ESMTP id D40DE900015 for ; Thu, 19 Mar 2015 13:10:47 -0400 (EDT) Received: by pdbop1 with SMTP id op1so81714099pdb.2 for ; Thu, 19 Mar 2015 10:10:47 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com. [192.55.52.93]) by mx.google.com with ESMTP id g5si4051260pda.134.2015.03.19.10.10.46 for ; Thu, 19 Mar 2015 10:10:47 -0700 (PDT) From: "Kirill A. Shutemov" Subject: [PATCH 15/16] page-flags: look on head page if the flag is encoded in page->mapping Date: Thu, 19 Mar 2015 19:08:21 +0200 Message-Id: <1426784902-125149-16-git-send-email-kirill.shutemov@linux.intel.com> In-Reply-To: <1426784902-125149-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1426784902-125149-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton , Andrea Arcangeli , Hugh Dickins Cc: Dave Hansen , Mel Gorman , Rik van Riel , Vlastimil Babka , Christoph Lameter , Naoya Horiguchi , Steve Capper , "Aneesh Kumar K.V" , Johannes Weiner , Michal Hocko , Jerome Marchand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" PageAnon() and PageKsm() look on lower bits of page->mapping to check if the page is Anon or KSM. page->mapping can be overloaded in tail pages. Let's always look on head page to avoid false-positives. Signed-off-by: Kirill A. Shutemov --- include/linux/page-flags.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 55a69c40e4ae..07fa2781df23 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -385,6 +385,7 @@ PAGEFLAG_FALSE(HWPoison) static inline int PageAnon(struct page *page) { + page = compound_head(page); return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; } @@ -397,6 +398,7 @@ static inline int PageAnon(struct page *page) */ static inline int PageKsm(struct page *page) { + page = compound_head(page); return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == (PAGE_MAPPING_ANON | PAGE_MAPPING_KSM); } -- 2.1.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