aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2009-01-06 17:39:41 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:04 -0500
commitb962716b459505a8d83aea313fea0abe76749f42 (patch)
treeb401e882f2ee8ff5a11209057496e603c211e8fe /mm
parent60371d971a3d01afd102f0bbf2681f32ecc31d78 (diff)
mm: optimize get_scan_ratio for no swap
Rik suggests a simplified get_scan_ratio() for !CONFIG_SWAP. Yes, the gcc optimizer gives us that, when nr_swap_pages is #defined as 0L. Move usual declaration to swapfile.c: it never belonged in page_alloc.c. Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Lee Schermerhorn <lee.schermerhorn@hp.com> Acked-by: Rik van Riel <riel@redhat.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Robin Holt <holt@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c1
-rw-r--r--mm/swapfile.c1
-rw-r--r--mm/vmscan.c12
3 files changed, 7 insertions, 7 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ce2a026219bc..65133436fe3d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -69,7 +69,6 @@ EXPORT_SYMBOL(node_states);
69 69
70unsigned long totalram_pages __read_mostly; 70unsigned long totalram_pages __read_mostly;
71unsigned long totalreserve_pages __read_mostly; 71unsigned long totalreserve_pages __read_mostly;
72long nr_swap_pages;
73int percpu_pagelist_fraction; 72int percpu_pagelist_fraction;
74 73
75#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE 74#ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 9ce7f81c8abc..725e56c362de 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -35,6 +35,7 @@
35 35
36static DEFINE_SPINLOCK(swap_lock); 36static DEFINE_SPINLOCK(swap_lock);
37static unsigned int nr_swapfiles; 37static unsigned int nr_swapfiles;
38long nr_swap_pages;
38long total_swap_pages; 39long total_swap_pages;
39static int swap_overflow; 40static int swap_overflow;
40static int least_priority; 41static int least_priority;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index f350523a8eee..d500b906746c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1327,12 +1327,6 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
1327 unsigned long anon_prio, file_prio; 1327 unsigned long anon_prio, file_prio;
1328 unsigned long ap, fp; 1328 unsigned long ap, fp;
1329 1329
1330 anon = zone_page_state(zone, NR_ACTIVE_ANON) +
1331 zone_page_state(zone, NR_INACTIVE_ANON);
1332 file = zone_page_state(zone, NR_ACTIVE_FILE) +
1333 zone_page_state(zone, NR_INACTIVE_FILE);
1334 free = zone_page_state(zone, NR_FREE_PAGES);
1335
1336 /* If we have no swap space, do not bother scanning anon pages. */ 1330 /* If we have no swap space, do not bother scanning anon pages. */
1337 if (nr_swap_pages <= 0) { 1331 if (nr_swap_pages <= 0) {
1338 percent[0] = 0; 1332 percent[0] = 0;
@@ -1340,6 +1334,12 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
1340 return; 1334 return;
1341 } 1335 }
1342 1336
1337 anon = zone_page_state(zone, NR_ACTIVE_ANON) +
1338 zone_page_state(zone, NR_INACTIVE_ANON);
1339 file = zone_page_state(zone, NR_ACTIVE_FILE) +
1340 zone_page_state(zone, NR_INACTIVE_FILE);
1341 free = zone_page_state(zone, NR_FREE_PAGES);
1342
1343 /* If we have very few page cache pages, force-scan anon pages. */ 1343 /* If we have very few page cache pages, force-scan anon pages. */
1344 if (unlikely(file + free <= zone->pages_high)) { 1344 if (unlikely(file + free <= zone->pages_high)) {
1345 percent[0] = 100; 1345 percent[0] = 100;