linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>, linux-mm@kvack.org
Subject: [patch 4/4] mm: return boolean from page_has_private()
Date: Tue, 21 Jul 2009 10:56:34 +0200	[thread overview]
Message-ID: <1248166594-8859-4-git-send-email-hannes@cmpxchg.org> (raw)
In-Reply-To: <1248166594-8859-1-git-send-email-hannes@cmpxchg.org>

Make page_has_private() return a true boolean value and remove the
double negations from the two callsites using it for arithmetic.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 include/linux/page-flags.h |   11 ++++++-----
 mm/migrate.c               |    2 +-
 mm/vmscan.c                |    2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index e2e5ce5..17119bd 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -396,8 +396,6 @@ static inline void __ClearPageTail(struct page *page)
  */
 #define PAGE_FLAGS_CHECK_AT_PREP	((1 << NR_PAGEFLAGS) - 1)
 
-#endif /* !__GENERATING_BOUNDS_H */
-
 /**
  * page_has_private - Determine if page has private stuff
  * @page: The page to be checked
@@ -405,8 +403,11 @@ static inline void __ClearPageTail(struct page *page)
  * Determine if a page has private stuff, indicating that release routines
  * should be invoked upon it.
  */
-#define page_has_private(page)			\
-	((page)->flags & ((1 << PG_private) |	\
-			  (1 << PG_private_2)))
+static inline int page_has_private(struct page *page)
+{
+	return !!(page->flags & ((1 << PG_private) | (1 << PG_private_2)));
+}
+
+#endif /* !__GENERATING_BOUNDS_H */
 
 #endif	/* PAGE_FLAGS_H */
diff --git a/mm/migrate.c b/mm/migrate.c
index e97e513..16052e8 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -272,7 +272,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
 	pslot = radix_tree_lookup_slot(&mapping->page_tree,
  					page_index(page));
 
-	expected_count = 2 + !!page_has_private(page);
+	expected_count = 2 + page_has_private(page);
 	if (page_count(page) != expected_count ||
 			(struct page *)radix_tree_deref_slot(pslot) != page) {
 		spin_unlock_irq(&mapping->tree_lock);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 6b368d3..67e2824 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -286,7 +286,7 @@ static inline int page_mapping_inuse(struct page *page)
 
 static inline int is_page_cache_freeable(struct page *page)
 {
-	return page_count(page) - !!page_has_private(page) == 2;
+	return page_count(page) - page_has_private(page) == 2;
 }
 
 static int may_write_to_queue(struct backing_dev_info *bdi)
-- 
1.6.3

--
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>

  parent reply	other threads:[~2009-07-21  8:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21  8:56 [patch 1/4] mm: drop unneeded double negations Johannes Weiner
2009-07-21  8:56 ` [patch 2/4] mm: introduce page_lru_type() Johannes Weiner
2009-07-22  1:52   ` Minchan Kim
2009-07-22  9:07     ` Johannes Weiner
2009-07-22 12:37       ` Minchan Kim
2009-07-22 16:01   ` Rik van Riel
2009-07-21  8:56 ` [patch 3/4] mm: return boolean from page_is_file_cache() Johannes Weiner
2009-07-21  8:56 ` Johannes Weiner [this message]
2009-07-22 16:49   ` [patch 4/4] mm: return boolean from page_has_private() Christoph Lameter
2009-07-22 17:50     ` Johannes Weiner
2009-07-22 17:54       ` [patch 5/4] mm: document is_page_cache_freeable() Johannes Weiner
2009-07-22 19:02         ` Christoph Lameter
2009-07-22 21:55           ` Li, Ming Chun
2009-07-22 22:10             ` Johannes Weiner
2009-07-22 23:51               ` Li, Ming Chun
2009-07-22 23:58               ` Christoph Lameter
2009-07-21  9:33 ` [patch 1/4] mm: drop unneeded double negations Mel Gorman
2009-07-21 11:18   ` Johannes Weiner

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=1248166594-8859-4-git-send-email-hannes@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    /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).