linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: use PageAnon() and PageKsm() helpers in page_anon_vma()
@ 2015-03-31 11:50 Kirill A. Shutemov
  2015-03-31 13:11 ` Christoph Lameter
  0 siblings, 1 reply; 9+ messages in thread
From: Kirill A. Shutemov @ 2015-03-31 11:50 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, Konstantin Khlebnikov, Rik van Riel, Kirill A. Shutemov

page_anon_vma() directly checks PAGE_MAPPING_ANON and PAGE_MAPPING_KSM
bits on page->mapping to find out if page->mapping is anon_vma;

Let's use PageAnon() and PageKsm() helpers instead. It helps readability
and makes page_anon_vma() work correctly on tail pages.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 include/linux/rmap.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 9c5ff69fa0cd..21f10e53bb9e 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -108,8 +108,7 @@ static inline void put_anon_vma(struct anon_vma *anon_vma)
 
 static inline struct anon_vma *page_anon_vma(struct page *page)
 {
-	if (((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) !=
-					    PAGE_MAPPING_ANON)
+	if (!PageAnon(page) || PageKsm(page))
 		return NULL;
 	return page_rmapping(page);
 }
-- 
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-04-02 11:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 11:50 [PATCH] mm: use PageAnon() and PageKsm() helpers in page_anon_vma() Kirill A. Shutemov
2015-03-31 13:11 ` Christoph Lameter
2015-03-31 14:35   ` Kirill A. Shutemov
2015-03-31 20:33     ` Andrew Morton
2015-04-01 11:50       ` Kirill A. Shutemov
2015-04-01 19:57         ` Andrew Morton
2015-04-01 22:02           ` Kirill A. Shutemov
2015-04-01 22:06             ` Andrew Morton
2015-04-02 11:34               ` Kirill A. Shutemov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).