From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by kanga.kvack.org (Postfix) with ESMTP id 11ECB82F66 for ; Thu, 24 Sep 2015 10:51:23 -0400 (EDT) Received: by pacex6 with SMTP id ex6so75184208pac.0 for ; Thu, 24 Sep 2015 07:51:22 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com. [134.134.136.65]) by mx.google.com with ESMTP id d10si18919416pas.77.2015.09.24.07.51.21 for ; Thu, 24 Sep 2015 07:51:22 -0700 (PDT) From: "Kirill A. Shutemov" Subject: [PATCH 15/16] page-flags: look at head page if the flag is encoded in page->mapping Date: Thu, 24 Sep 2015 17:51:03 +0300 Message-Id: <1443106264-78075-16-git-send-email-kirill.shutemov@linux.intel.com> In-Reply-To: <1443106264-78075-1-git-send-email-kirill.shutemov@linux.intel.com> References: <20150921153509.fef7ecdf313ef74307c43b65@linux-foundation.org> <1443106264-78075-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Andrea Arcangeli , Hugh Dickins , 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 , Sasha Levin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Kirill A. Shutemov" PageAnon() and PageKsm() look at 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 at 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 e3ccd95de660..6f5df65d1038 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -369,6 +369,7 @@ PAGEFLAG(Idle, idle, PF_ANY) static inline int PageAnon(struct page *page) { + page = compound_head(page); return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; } @@ -381,6 +382,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.5.1 -- 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