Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1232158 > unrolled thread

[PATCH 15/16] page-flags: look at head page if the flag is encoded in page->mapping

Started by"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
First post2015-09-24 17:00 +0200
Last post2015-09-24 17:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 15/16] page-flags: look at head page if the flag is encoded in page->mapping "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2015-09-24 17:00 +0200

#1232158 — [PATCH 15/16] page-flags: look at head page if the flag is encoded in page->mapping

From"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date2015-09-24 17:00 +0200
Subject[PATCH 15/16] page-flags: look at head page if the flag is encoded in page->mapping
Message-ID<qcga8-6cP-53@gated-at.bofh.it>
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 <kirill.shutemov@linux.intel.com>
---
 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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web