linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] vmscan: get_scan_ratio cleanup
@ 2010-01-13  8:19 KOSAKI Motohiro
  2010-01-13  8:21 ` [PATCH 2/3][v2] vmstat: add anon_scan_ratio field to zoneinfo KOSAKI Motohiro
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: KOSAKI Motohiro @ 2010-01-13  8:19 UTC (permalink / raw)
  To: LKML, linux-mm, Andrew Morton, Balbir Singh, KAMEZAWA Hiroyuki,
	Rik van Riel, Minchan Kim
  Cc: kosaki.motohiro

The get_scan_ratio() should have all scan-ratio related calculations.
Thus, this patch move some calculation into get_scan_ratio.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/vmscan.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2bbee91..640486b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1501,6 +1501,13 @@ static void get_scan_ratio(struct zone *zone, struct scan_control *sc,
 	unsigned long ap, fp;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
 
+	/* If we have no swap space, do not bother scanning anon pages. */
+	if (!sc->may_swap || (nr_swap_pages <= 0)) {
+		percent[0] = 0;
+		percent[1] = 100;
+		return;
+	}
+
 	anon  = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_ANON) +
 		zone_nr_lru_pages(zone, sc, LRU_INACTIVE_ANON);
 	file  = zone_nr_lru_pages(zone, sc, LRU_ACTIVE_FILE) +
@@ -1598,22 +1605,20 @@ static void shrink_zone(int priority, struct zone *zone,
 	unsigned long nr_reclaimed = sc->nr_reclaimed;
 	unsigned long nr_to_reclaim = sc->nr_to_reclaim;
 	struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
-	int noswap = 0;
 
-	/* If we have no swap space, do not bother scanning anon pages. */
-	if (!sc->may_swap || (nr_swap_pages <= 0)) {
-		noswap = 1;
-		percent[0] = 0;
-		percent[1] = 100;
-	} else
-		get_scan_ratio(zone, sc, percent);
+	get_scan_ratio(zone, sc, percent);
 
 	for_each_evictable_lru(l) {
 		int file = is_file_lru(l);
 		unsigned long scan;
 
+		if (percent[file] == 0) {
+			nr[l] = 0;
+			continue;
+		}
+
 		scan = zone_nr_lru_pages(zone, sc, l);
-		if (priority || noswap) {
+		if (priority) {
 			scan >>= priority;
 			scan = (scan * percent[file]) / 100;
 		}
-- 
1.6.5.2



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

end of thread, other threads:[~2010-01-18  2:25 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13  8:19 [PATCH 1/3] vmscan: get_scan_ratio cleanup KOSAKI Motohiro
2010-01-13  8:21 ` [PATCH 2/3][v2] vmstat: add anon_scan_ratio field to zoneinfo KOSAKI Motohiro
2010-01-13 10:31   ` Minchan Kim
2010-01-13 23:50     ` KOSAKI Motohiro
2010-01-14  5:12       ` Minchan Kim
2010-01-14  5:18         ` KOSAKI Motohiro
2010-01-15 17:23           ` Minchan Kim
2010-01-18  1:04             ` KOSAKI Motohiro
2010-01-18  1:47               ` Minchan Kim
2010-01-18  1:54                 ` KOSAKI Motohiro
2010-01-18  2:10                   ` Minchan Kim
2010-01-18  2:14                     ` KOSAKI Motohiro
2010-01-18  2:16                     ` Rik van Riel
2010-01-18  2:24                       ` KOSAKI Motohiro
2010-01-18  2:25                       ` Minchan Kim
2010-01-13  8:22 ` [PATCH 3/3] [v2] memcg: add anon_scan_ratio to memory.stat file KOSAKI Motohiro
2010-01-13  8:24   ` KAMEZAWA Hiroyuki
2010-01-13  9:08   ` Balbir Singh
2010-01-13  9:54 ` [PATCH 1/3] vmscan: get_scan_ratio cleanup Minchan Kim

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