linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/5] mm: drop unneeded double negations
@ 2009-08-12  8:32 Johannes Weiner
  2009-08-12  8:32 ` [patch 2/5] mm: introduce page_lru_base_type() Johannes Weiner
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Johannes Weiner @ 2009-08-12  8:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Mel Gorman

Remove double negations where the operand is already boolean.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mel@csn.ul.ie>
---
 mm/memcontrol.c |    2 +-
 mm/memory.c     |    2 +-
 mm/vmscan.c     |    8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

v2: leave double negation for TestClearPageActive() until bitops
semantics are sorted out [thanks, Mel]

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 48a38e1..140b5a6 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -900,7 +900,7 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
 	int nid = z->zone_pgdat->node_id;
 	int zid = zone_idx(z);
 	struct mem_cgroup_per_zone *mz;
-	int lru = LRU_FILE * !!file + !!active;
+	int lru = LRU_FILE * file + active;
 	int ret;
 
 	BUG_ON(!mem_cont);
diff --git a/mm/memory.c b/mm/memory.c
index 2fadf30..574cd3e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -598,7 +598,7 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 	if (page) {
 		get_page(page);
 		page_dup_rmap(page);
-		rss[!!PageAnon(page)]++;
+		rss[PageAnon(page)]++;
 	}
 
 out_set_pte:
diff --git a/mm/vmscan.c b/mm/vmscan.c
index bcddc75..9a4c298 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -966,7 +966,7 @@ static unsigned long isolate_pages_global(unsigned long nr,
 	if (file)
 		lru += LRU_FILE;
 	return isolate_lru_pages(nr, &z->lru[lru].list, dst, scanned, order,
-								mode, !!file);
+								mode, file);
 }
 
 /*
@@ -1204,7 +1204,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan,
 			lru = page_lru(page);
 			add_page_to_lru_list(zone, page, lru);
 			if (is_active_lru(lru)) {
-				int file = !!is_file_lru(lru);
+				int file = is_file_lru(lru);
 				reclaim_stat->recent_rotated[file]++;
 			}
 			if (!pagevec_add(&pvec, page)) {
@@ -1314,7 +1314,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 	if (scanning_global_lru(sc)) {
 		zone->pages_scanned += pgscanned;
 	}
-	reclaim_stat->recent_scanned[!!file] += nr_taken;
+	reclaim_stat->recent_scanned[file] += nr_taken;
 
 	__count_zone_vm_events(PGREFILL, zone, pgscanned);
 	if (file)
@@ -1367,7 +1367,7 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 	 * helps balance scan pressure between file and anonymous pages in
 	 * get_scan_ratio.
 	 */
-	reclaim_stat->recent_rotated[!!file] += nr_rotated;
+	reclaim_stat->recent_rotated[file] += nr_rotated;
 
 	move_active_pages_to_lru(zone, &l_active,
 						LRU_ACTIVE + file * LRU_FILE);
-- 
1.6.4.13.ge6580

--
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	[flat|nested] 12+ messages in thread

* [patch 2/5] mm: introduce page_lru_base_type()
  2009-08-12  8:32 [patch 1/5] mm: drop unneeded double negations Johannes Weiner
@ 2009-08-12  8:32 ` Johannes Weiner
  2009-08-14  6:56   ` KOSAKI Motohiro
  2009-08-12  8:32 ` [patch 3/5] mm: return boolean from page_is_file_cache() Johannes Weiner
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Johannes Weiner @ 2009-08-12  8:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Minchan Kim

Instead of abusing page_is_file_cache() for LRU list index arithmetic,
add another helper with a more appropriate name and convert the
non-boolean users of page_is_file_cache() accordingly.

This new helper gives the LRU base type a page is supposed to live on,
inactive anon or inactive file.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
---
 include/linux/mm_inline.h |   19 +++++++++++++++++--
 mm/swap.c                 |    4 ++--
 mm/vmscan.c               |    6 +++---
 3 files changed, 22 insertions(+), 7 deletions(-)

v2: renamed from page_lru_type() [thanks, Minchan]

diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 7fbb972..6c8118b 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -60,6 +60,21 @@ del_page_from_lru(struct zone *zone, struct page *page)
 }
 
 /**
+ * page_lru_base_type - which LRU list type should a page be on?
+ * @page: the page to test
+ *
+ * Used for LRU list index arithmetic.
+ *
+ * Returns the base LRU type - file or anon - @page should be on.
+ */
+static enum lru_list page_lru_base_type(struct page *page)
+{
+	if (page_is_file_cache(page))
+		return LRU_INACTIVE_FILE;
+	return LRU_INACTIVE_ANON;
+}
+
+/**
  * page_lru - which LRU list should a page be on?
  * @page: the page to test
  *
@@ -68,14 +83,14 @@ del_page_from_lru(struct zone *zone, struct page *page)
  */
 static inline enum lru_list page_lru(struct page *page)
 {
-	enum lru_list lru = LRU_BASE;
+	enum lru_list lru;
 
 	if (PageUnevictable(page))
 		lru = LRU_UNEVICTABLE;
 	else {
+		lru = page_lru_base_type(page);
 		if (PageActive(page))
 			lru += LRU_ACTIVE;
-		lru += page_is_file_cache(page);
 	}
 
 	return lru;
diff --git a/mm/swap.c b/mm/swap.c
index cb29ae5..168d53e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -118,7 +118,7 @@ static void pagevec_move_tail(struct pagevec *pvec)
 			spin_lock(&zone->lru_lock);
 		}
 		if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
-			int lru = page_is_file_cache(page);
+			int lru = page_lru_base_type(page);
 			list_move_tail(&page->lru, &zone->lru[lru].list);
 			pgmoved++;
 		}
@@ -181,7 +181,7 @@ void activate_page(struct page *page)
 	spin_lock_irq(&zone->lru_lock);
 	if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
 		int file = page_is_file_cache(page);
-		int lru = LRU_BASE + file;
+		int lru = page_lru_base_type(page);
 		del_page_from_lru_list(zone, page, lru);
 
 		SetPageActive(page);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9a4c298..679c729 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -531,7 +531,7 @@ redo:
 		 * unevictable page on [in]active list.
 		 * We know how to handle that.
 		 */
-		lru = active + page_is_file_cache(page);
+		lru = active + page_lru_base_type(page);
 		lru_cache_add_lru(page, lru);
 	} else {
 		/*
@@ -981,7 +981,7 @@ static unsigned long clear_active_flags(struct list_head *page_list,
 	struct page *page;
 
 	list_for_each_entry(page, page_list, lru) {
-		lru = page_is_file_cache(page);
+		lru = page_lru_base_type(page);
 		if (PageActive(page)) {
 			lru += LRU_ACTIVE;
 			ClearPageActive(page);
@@ -2690,7 +2690,7 @@ static void check_move_unevictable_page(struct page *page, struct zone *zone)
 retry:
 	ClearPageUnevictable(page);
 	if (page_evictable(page, NULL)) {
-		enum lru_list l = LRU_INACTIVE_ANON + page_is_file_cache(page);
+		enum lru_list l = page_lru_base_type(page);
 
 		__dec_zone_state(zone, NR_UNEVICTABLE);
 		list_move(&page->lru, &zone->lru[l].list);
-- 
1.6.4.13.ge6580

--
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	[flat|nested] 12+ messages in thread

* [patch 3/5] mm: return boolean from page_is_file_cache()
  2009-08-12  8:32 [patch 1/5] mm: drop unneeded double negations Johannes Weiner
  2009-08-12  8:32 ` [patch 2/5] mm: introduce page_lru_base_type() Johannes Weiner
@ 2009-08-12  8:32 ` Johannes Weiner
  2009-08-14  6:56   ` KOSAKI Motohiro
  2009-08-12  8:32 ` [patch 4/5] mm: return boolean from page_has_private() Johannes Weiner
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Johannes Weiner @ 2009-08-12  8:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm

page_is_file_cache() has been used for both boolean checks and LRU
arithmetic, which was always a bit weird.

Now that page_lru_base_type() exists for LRU arithmetic, make
page_is_file_cache() a real predicate function and adjust the
boolean-using callsites to drop those pesky double negations.

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

diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 6c8118b..e72d8fb 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -5,7 +5,7 @@
  * page_is_file_cache - should the page be on a file LRU or anon LRU?
  * @page: the page to test
  *
- * Returns LRU_FILE if @page is page cache page backed by a regular filesystem,
+ * Returns 1 if @page is page cache page backed by a regular filesystem,
  * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
  * Used by functions that manipulate the LRU lists, to sort a page
  * onto the right LRU list.
@@ -16,11 +16,7 @@
  */
 static inline int page_is_file_cache(struct page *page)
 {
-	if (PageSwapBacked(page))
-		return 0;
-
-	/* The page is page cache backed by a normal filesystem. */
-	return LRU_FILE;
+	return !PageSwapBacked(page);
 }
 
 static inline void
diff --git a/mm/migrate.c b/mm/migrate.c
index b535a2c..e97e513 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -68,7 +68,7 @@ int putback_lru_pages(struct list_head *l)
 	list_for_each_entry_safe(page, page2, l, lru) {
 		list_del(&page->lru);
 		dec_zone_page_state(page, NR_ISOLATED_ANON +
-				    !!page_is_file_cache(page));
+				page_is_file_cache(page));
 		putback_lru_page(page);
 		count++;
 	}
@@ -701,7 +701,7 @@ unlock:
  		 */
  		list_del(&page->lru);
 		dec_zone_page_state(page, NR_ISOLATED_ANON +
-				    !!page_is_file_cache(page));
+				page_is_file_cache(page));
 		putback_lru_page(page);
 	}
 
@@ -751,7 +751,7 @@ int migrate_pages(struct list_head *from,
 	local_irq_save(flags);
 	list_for_each_entry(page, from, lru)
 		__inc_zone_page_state(page, NR_ISOLATED_ANON +
-				      !!page_is_file_cache(page));
+				page_is_file_cache(page));
 	local_irq_restore(flags);
 
 	if (!swapwrite)
diff --git a/mm/swap.c b/mm/swap.c
index 168d53e..4a8a59e 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -189,7 +189,7 @@ void activate_page(struct page *page)
 		add_page_to_lru_list(zone, page, lru);
 		__count_vm_event(PGACTIVATE);
 
-		update_page_reclaim_stat(zone, page, !!file, 1);
+		update_page_reclaim_stat(zone, page, file, 1);
 	}
 	spin_unlock_irq(&zone->lru_lock);
 }
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 679c729..b0f8fc2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -816,7 +816,7 @@ int __isolate_lru_page(struct page *page, int mode, int file)
 	if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode))
 		return ret;
 
-	if (mode != ISOLATE_BOTH && (!page_is_file_cache(page) != !file))
+	if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
 		return ret;
 
 	/*
-- 
1.6.4.13.ge6580

--
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	[flat|nested] 12+ messages in thread

* [patch 4/5] mm: return boolean from page_has_private()
  2009-08-12  8:32 [patch 1/5] mm: drop unneeded double negations Johannes Weiner
  2009-08-12  8:32 ` [patch 2/5] mm: introduce page_lru_base_type() Johannes Weiner
  2009-08-12  8:32 ` [patch 3/5] mm: return boolean from page_is_file_cache() Johannes Weiner
@ 2009-08-12  8:32 ` Johannes Weiner
  2009-08-12 13:57   ` Christoph Lameter
  2009-08-14  6:56   ` KOSAKI Motohiro
  2009-08-12  8:32 ` [patch 5/5] mm: document is_page_cache_freeable() Johannes Weiner
  2009-08-14  6:56 ` [patch 1/5] mm: drop unneeded double negations KOSAKI Motohiro
  4 siblings, 2 replies; 12+ messages in thread
From: Johannes Weiner @ 2009-08-12  8:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Christoph Lameter

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>
Cc: Christoph Lameter <cl@linux-foundation.org>
---
 include/linux/page-flags.h |   13 ++++++++-----
 mm/migrate.c               |    2 +-
 mm/vmscan.c                |    2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

v2: group private flags in PAGE_FLAGS_PRIVATE [thanks, Christoph]

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 10e6011..840c53b 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -402,8 +402,8 @@ static inline void __ClearPageTail(struct page *page)
  */
 #define PAGE_FLAGS_CHECK_AT_PREP	((1 << NR_PAGEFLAGS) - 1)
 
-#endif /* !__GENERATING_BOUNDS_H */
-
+#define PAGE_FLAGS_PRIVATE				\
+	(1 << PG_private | 1 << PG_private_2)
 /**
  * page_has_private - Determine if page has private stuff
  * @page: The page to be checked
@@ -411,8 +411,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 & PAGE_FLAGS_PRIVATE);
+}
+
+#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 b0f8fc2..4904986 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.4.13.ge6580

--
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	[flat|nested] 12+ messages in thread

* [patch 5/5] mm: document is_page_cache_freeable()
  2009-08-12  8:32 [patch 1/5] mm: drop unneeded double negations Johannes Weiner
                   ` (2 preceding siblings ...)
  2009-08-12  8:32 ` [patch 4/5] mm: return boolean from page_has_private() Johannes Weiner
@ 2009-08-12  8:32 ` Johannes Weiner
  2009-08-12 13:58   ` Christoph Lameter
  2009-08-14  6:56   ` KOSAKI Motohiro
  2009-08-14  6:56 ` [patch 1/5] mm: drop unneeded double negations KOSAKI Motohiro
  4 siblings, 2 replies; 12+ messages in thread
From: Johannes Weiner @ 2009-08-12  8:32 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Christoph Lameter

Enlighten the reader of this code about what reference count makes a
page cache page freeable.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
---
 mm/vmscan.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

v2: describe reference holders a bit better [thanks, Christoph]

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4904986..5bb1055 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -286,6 +286,11 @@ static inline int page_mapping_inuse(struct page *page)
 
 static inline int is_page_cache_freeable(struct page *page)
 {
+	/*
+	 * A freeable page cache page is referenced only by the caller
+	 * that isolated the page, the page cache radix tree and
+	 * optional buffer heads at page->private.
+	 */
 	return page_count(page) - page_has_private(page) == 2;
 }
 
-- 
1.6.4.13.ge6580

--
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	[flat|nested] 12+ messages in thread

* Re: [patch 4/5] mm: return boolean from page_has_private()
  2009-08-12  8:32 ` [patch 4/5] mm: return boolean from page_has_private() Johannes Weiner
@ 2009-08-12 13:57   ` Christoph Lameter
  2009-08-14  6:56   ` KOSAKI Motohiro
  1 sibling, 0 replies; 12+ messages in thread
From: Christoph Lameter @ 2009-08-12 13:57 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: Andrew Morton, linux-mm


Reviewed-by: Christoph Lameter <cl@linux-foundation.org>


--
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	[flat|nested] 12+ messages in thread

* Re: [patch 5/5] mm: document is_page_cache_freeable()
  2009-08-12  8:32 ` [patch 5/5] mm: document is_page_cache_freeable() Johannes Weiner
@ 2009-08-12 13:58   ` Christoph Lameter
  2009-08-14  6:56   ` KOSAKI Motohiro
  1 sibling, 0 replies; 12+ messages in thread
From: Christoph Lameter @ 2009-08-12 13:58 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: Andrew Morton, linux-mm


Reviewed-by: Christoph Lameter <cl@linux-foundation.org>

--
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	[flat|nested] 12+ messages in thread

* Re: [patch 2/5] mm: introduce page_lru_base_type()
  2009-08-12  8:32 ` [patch 2/5] mm: introduce page_lru_base_type() Johannes Weiner
@ 2009-08-14  6:56   ` KOSAKI Motohiro
  0 siblings, 0 replies; 12+ messages in thread
From: KOSAKI Motohiro @ 2009-08-14  6:56 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: kosaki.motohiro, Andrew Morton, linux-mm, Minchan Kim

> Instead of abusing page_is_file_cache() for LRU list index arithmetic,
> add another helper with a more appropriate name and convert the
> non-boolean users of page_is_file_cache() accordingly.
> 
> This new helper gives the LRU base type a page is supposed to live on,
> inactive anon or inactive file.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Reviewed-by: Rik van Riel <riel@redhat.com>
> Cc: Minchan Kim <minchan.kim@gmail.com>

Looks good to me.
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>



--
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	[flat|nested] 12+ messages in thread

* Re: [patch 5/5] mm: document is_page_cache_freeable()
  2009-08-12  8:32 ` [patch 5/5] mm: document is_page_cache_freeable() Johannes Weiner
  2009-08-12 13:58   ` Christoph Lameter
@ 2009-08-14  6:56   ` KOSAKI Motohiro
  1 sibling, 0 replies; 12+ messages in thread
From: KOSAKI Motohiro @ 2009-08-14  6:56 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: kosaki.motohiro, Andrew Morton, linux-mm, Christoph Lameter

> @@ -286,6 +286,11 @@ static inline int page_mapping_inuse(struct page *page)
>  
>  static inline int is_page_cache_freeable(struct page *page)
>  {
> +	/*
> +	 * A freeable page cache page is referenced only by the caller
> +	 * that isolated the page, the page cache radix tree and
> +	 * optional buffer heads at page->private.
> +	 */
>  	return page_count(page) - page_has_private(page) == 2;
>  }

Looks good to me.
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>





--
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	[flat|nested] 12+ messages in thread

* Re: [patch 3/5] mm: return boolean from page_is_file_cache()
  2009-08-12  8:32 ` [patch 3/5] mm: return boolean from page_is_file_cache() Johannes Weiner
@ 2009-08-14  6:56   ` KOSAKI Motohiro
  0 siblings, 0 replies; 12+ messages in thread
From: KOSAKI Motohiro @ 2009-08-14  6:56 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: kosaki.motohiro, Andrew Morton, linux-mm

> page_is_file_cache() has been used for both boolean checks and LRU
> arithmetic, which was always a bit weird.
> 
> Now that page_lru_base_type() exists for LRU arithmetic, make
> page_is_file_cache() a real predicate function and adjust the
> boolean-using callsites to drop those pesky double negations.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Looks good to me.
	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>



--
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	[flat|nested] 12+ messages in thread

* Re: [patch 4/5] mm: return boolean from page_has_private()
  2009-08-12  8:32 ` [patch 4/5] mm: return boolean from page_has_private() Johannes Weiner
  2009-08-12 13:57   ` Christoph Lameter
@ 2009-08-14  6:56   ` KOSAKI Motohiro
  1 sibling, 0 replies; 12+ messages in thread
From: KOSAKI Motohiro @ 2009-08-14  6:56 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: kosaki.motohiro, Andrew Morton, linux-mm, Christoph Lameter

> 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>
> Cc: Christoph Lameter <cl@linux-foundation.org>

	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>



--
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	[flat|nested] 12+ messages in thread

* Re: [patch 1/5] mm: drop unneeded double negations
  2009-08-12  8:32 [patch 1/5] mm: drop unneeded double negations Johannes Weiner
                   ` (3 preceding siblings ...)
  2009-08-12  8:32 ` [patch 5/5] mm: document is_page_cache_freeable() Johannes Weiner
@ 2009-08-14  6:56 ` KOSAKI Motohiro
  4 siblings, 0 replies; 12+ messages in thread
From: KOSAKI Motohiro @ 2009-08-14  6:56 UTC (permalink / raw)
  To: Johannes Weiner; +Cc: kosaki.motohiro, Andrew Morton, linux-mm, Mel Gorman

> Remove double negations where the operand is already boolean.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Mel Gorman <mel@csn.ul.ie>

	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>



--
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	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-08-14  6:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-12  8:32 [patch 1/5] mm: drop unneeded double negations Johannes Weiner
2009-08-12  8:32 ` [patch 2/5] mm: introduce page_lru_base_type() Johannes Weiner
2009-08-14  6:56   ` KOSAKI Motohiro
2009-08-12  8:32 ` [patch 3/5] mm: return boolean from page_is_file_cache() Johannes Weiner
2009-08-14  6:56   ` KOSAKI Motohiro
2009-08-12  8:32 ` [patch 4/5] mm: return boolean from page_has_private() Johannes Weiner
2009-08-12 13:57   ` Christoph Lameter
2009-08-14  6:56   ` KOSAKI Motohiro
2009-08-12  8:32 ` [patch 5/5] mm: document is_page_cache_freeable() Johannes Weiner
2009-08-12 13:58   ` Christoph Lameter
2009-08-14  6:56   ` KOSAKI Motohiro
2009-08-14  6:56 ` [patch 1/5] mm: drop unneeded double negations KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox