linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, Konstantin Khlebnikov <koct9i@gmail.com>,
	Rik van Riel <riel@redhat.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: [PATCH] mm: use PageAnon() and PageKsm() helpers in page_anon_vma()
Date: Tue, 31 Mar 2015 14:50:47 +0300	[thread overview]
Message-ID: <1427802647-16764-1-git-send-email-kirill.shutemov@linux.intel.com> (raw)

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>

             reply	other threads:[~2015-03-31 11:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 11:50 Kirill A. Shutemov [this message]
2015-03-31 13:11 ` [PATCH] mm: use PageAnon() and PageKsm() helpers in page_anon_vma() 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427802647-16764-1-git-send-email-kirill.shutemov@linux.intel.com \
    --to=kirill.shutemov@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=koct9i@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).