aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2009-09-21 20:02:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:37 -0400
commit6c0b13519d1c755d874e82c8fb8a6dcef0ee402c (patch)
tree0fe6e6902a488ad6c59ecee971fe64c81edbcce3
parent401a8e1c1670085b8177330ca47d4f7c4ac88761 (diff)
mm: return boolean from page_is_file_cache()
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> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/mm_inline.h8
-rw-r--r--mm/migrate.c6
-rw-r--r--mm/swap.c2
-rw-r--r--mm/vmscan.c2
4 files changed, 7 insertions, 11 deletions
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index 99977ff45b83..8835b877b8db 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -5,7 +5,7 @@
5 * page_is_file_cache - should the page be on a file LRU or anon LRU? 5 * page_is_file_cache - should the page be on a file LRU or anon LRU?
6 * @page: the page to test 6 * @page: the page to test
7 * 7 *
8 * Returns LRU_FILE if @page is page cache page backed by a regular filesystem, 8 * Returns 1 if @page is page cache page backed by a regular filesystem,
9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. 9 * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed.
10 * Used by functions that manipulate the LRU lists, to sort a page 10 * Used by functions that manipulate the LRU lists, to sort a page
11 * onto the right LRU list. 11 * onto the right LRU list.
@@ -16,11 +16,7 @@
16 */ 16 */
17static inline int page_is_file_cache(struct page *page) 17static inline int page_is_file_cache(struct page *page)
18{ 18{
19 if (PageSwapBacked(page)) 19 return !PageSwapBacked(page);
20 return 0;
21
22 /* The page is page cache backed by a normal filesystem. */
23 return LRU_FILE;
24} 20}
25 21
26static inline void 22static inline void
diff --git a/mm/migrate.c b/mm/migrate.c
index b535a2c1656c..e97e513fe898 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -68,7 +68,7 @@ int putback_lru_pages(struct list_head *l)
68 list_for_each_entry_safe(page, page2, l, lru) { 68 list_for_each_entry_safe(page, page2, l, lru) {
69 list_del(&page->lru); 69 list_del(&page->lru);
70 dec_zone_page_state(page, NR_ISOLATED_ANON + 70 dec_zone_page_state(page, NR_ISOLATED_ANON +
71 !!page_is_file_cache(page)); 71 page_is_file_cache(page));
72 putback_lru_page(page); 72 putback_lru_page(page);
73 count++; 73 count++;
74 } 74 }
@@ -701,7 +701,7 @@ unlock:
701 */ 701 */
702 list_del(&page->lru); 702 list_del(&page->lru);
703 dec_zone_page_state(page, NR_ISOLATED_ANON + 703 dec_zone_page_state(page, NR_ISOLATED_ANON +
704 !!page_is_file_cache(page)); 704 page_is_file_cache(page));
705 putback_lru_page(page); 705 putback_lru_page(page);
706 } 706 }
707 707
@@ -751,7 +751,7 @@ int migrate_pages(struct list_head *from,
751 local_irq_save(flags); 751 local_irq_save(flags);
752 list_for_each_entry(page, from, lru) 752 list_for_each_entry(page, from, lru)
753 __inc_zone_page_state(page, NR_ISOLATED_ANON + 753 __inc_zone_page_state(page, NR_ISOLATED_ANON +
754 !!page_is_file_cache(page)); 754 page_is_file_cache(page));
755 local_irq_restore(flags); 755 local_irq_restore(flags);
756 756
757 if (!swapwrite) 757 if (!swapwrite)
diff --git a/mm/swap.c b/mm/swap.c
index 168d53e6e58e..4a8a59e671f7 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -189,7 +189,7 @@ void activate_page(struct page *page)
189 add_page_to_lru_list(zone, page, lru); 189 add_page_to_lru_list(zone, page, lru);
190 __count_vm_event(PGACTIVATE); 190 __count_vm_event(PGACTIVATE);
191 191
192 update_page_reclaim_stat(zone, page, !!file, 1); 192 update_page_reclaim_stat(zone, page, file, 1);
193 } 193 }
194 spin_unlock_irq(&zone->lru_lock); 194 spin_unlock_irq(&zone->lru_lock);
195} 195}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 30e56ee833f8..172119caebcc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -821,7 +821,7 @@ int __isolate_lru_page(struct page *page, int mode, int file)
821 if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode)) 821 if (mode != ISOLATE_BOTH && (!PageActive(page) != !mode))
822 return ret; 822 return ret;
823 823
824 if (mode != ISOLATE_BOTH && (!page_is_file_cache(page) != !file)) 824 if (mode != ISOLATE_BOTH && page_is_file_cache(page) != file)
825 return ret; 825 return ret;
826 826
827 /* 827 /*