diff options
author | Hugh Dickins <hugh@veritas.com> | 2009-01-06 17:39:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:04 -0500 |
commit | b962716b459505a8d83aea313fea0abe76749f42 (patch) | |
tree | b401e882f2ee8ff5a11209057496e603c211e8fe /mm/vmscan.c | |
parent | 60371d971a3d01afd102f0bbf2681f32ecc31d78 (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/vmscan.c')
-rw-r--r-- | mm/vmscan.c | 12 |
1 files changed, 6 insertions, 6 deletions
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; |