[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJd=RBDVxT5Pc2HZjz15LUb7xhFbztpFmXqLXVB3nCoQLKHiHg@mail.gmail.com>
Date: Sat, 21 Jan 2012 22:41:59 +0800
From: Hillf Danton <dhillf@...il.com>
To: linux-mm@...ck.org
Cc: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Hillf Danton <dhillf@...il.com>
Subject: [PATCH] mm: vmscan: fix malused nr_reclaimed in shrinking zone
The value of nr_reclaimed is the amount of pages reclaimed in the current round,
whereas nr_to_reclaim shoud be compared with the amount of pages
reclaimed in all
rounds, so we have to buffer the pages reclaimed in the past rounds for correct
comparison.
Signed-off-by: Hillf Danton <dhillf@...il.com>
---
--- a/mm/vmscan.c Sat Jan 14 14:02:20 2012
+++ b/mm/vmscan.c Sat Jan 21 22:23:48 2012
@@ -2081,13 +2081,15 @@ static void shrink_mem_cgroup_zone(int p
struct scan_control *sc)
{
unsigned long nr[NR_LRU_LISTS];
+ unsigned long reclaimed = 0;
unsigned long nr_to_scan;
enum lru_list lru;
- unsigned long nr_reclaimed, nr_scanned;
+ unsigned long nr_reclaimed = 0, nr_scanned;
unsigned long nr_to_reclaim = sc->nr_to_reclaim;
struct blk_plug plug;
restart:
+ reclaimed += nr_reclaimed;
nr_reclaimed = 0;
nr_scanned = sc->nr_scanned;
get_scan_count(mz, sc, nr, priority);
@@ -2113,7 +2115,8 @@ restart:
* with multiple processes reclaiming pages, the total
* freeing target can get unreasonably large.
*/
- if (nr_reclaimed >= nr_to_reclaim && priority < DEF_PRIORITY)
+ if ((nr_reclaimed + reclaimed) >= nr_to_reclaim &&
+ priority < DEF_PRIORITY)
break;
}
blk_finish_plug(&plug);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists