From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933911AbbCDQdx (ORCPT ); Wed, 4 Mar 2015 11:33:53 -0500 Received: from mga02.intel.com ([134.134.136.20]:8247 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933478AbbCDQdv (ORCPT ); Wed, 4 Mar 2015 11:33:51 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,688,1418112000"; d="scan'208";a="660394989" From: "Kirill A. Shutemov" To: Andrew Morton , Andrea Arcangeli Cc: Dave Hansen , Hugh Dickins , 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" Subject: [PATCHv4 02/24] mm: change PageAnon() and page_anon_vma() to work on tail pages Date: Wed, 4 Mar 2015 18:32:50 +0200 Message-Id: <1425486792-93161-3-git-send-email-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1425486792-93161-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1425486792-93161-1-git-send-email-kirill.shutemov@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently PageAnon() and page_anon_vma() are always return false/NULL for tail. We need to look on head page for correct answer. Let's change the function to give the correct result for tail page. Signed-off-by: Kirill A. Shutemov --- include/linux/mm.h | 1 + include/linux/rmap.h | 1 + 2 files changed, 2 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9c21b42d07bf..1aea94e837a0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1047,6 +1047,7 @@ struct address_space *page_file_mapping(struct page *page) static inline int PageAnon(struct page *page) { + page = compound_head(page); return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0; } diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 9c5ff69fa0cd..c4088feac1fc 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -108,6 +108,7 @@ static inline void put_anon_vma(struct anon_vma *anon_vma) static inline struct anon_vma *page_anon_vma(struct page *page) { + page = compound_head(page); if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON) return NULL; -- 2.1.4