All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 5/5] memcg: change the target nr_to_reclaim for each memcg under kswapd
@ 2012-04-11 22:00 Ying Han
  2012-04-11 23:56 ` Johannes Weiner
  2012-04-15  1:57 ` Hillf Danton
  0 siblings, 2 replies; 8+ messages in thread
From: Ying Han @ 2012-04-11 22:00 UTC (permalink / raw)
  To: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer
  Cc: linux-mm

Under global background reclaim, the sc->nr_to_reclaim is set to
ULONG_MAX. Now we are iterating all memcgs under the zone and we
shouldn't pass the pressure from kswapd for each memcg.

After all, the balance_pgdat() breaks after reclaiming SWAP_CLUSTER_MAX
pages to prevent building up reclaim priorities.

Signed-off-by: Ying Han <yinghan@google.com>
---
 mm/vmscan.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index d65eae4..ca70ec6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2083,9 +2083,18 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz,
 	unsigned long nr_to_scan;
 	enum lru_list lru;
 	unsigned long nr_reclaimed, nr_scanned;
-	unsigned long nr_to_reclaim = sc->nr_to_reclaim;
+	unsigned long nr_to_reclaim;
 	struct blk_plug plug;
 
+	/*
+	 * Under global background reclaim, the sc->nr_to_reclaim is set to
+	 * ULONG_MAX. Now we are iterating all memcgs under the zone and we
+	 * shouldn't pass the pressure from kswapd for each memcg. After all,
+	 * the balance_pgdat() breaks after reclaiming SWAP_CLUSTER_MAX pages
+	 * to prevent building up reclaim priorities.
+	 */
+	nr_to_reclaim = min_t(unsigned long,
+			      sc->nr_to_reclaim, SWAP_CLUSTER_MAX);
 restart:
 	nr_reclaimed = 0;
 	nr_scanned = sc->nr_scanned;
@@ -2755,7 +2764,6 @@ loop_again:
 					high_wmark_pages(zone) + balance_gap,
 					end_zone, 0)) {
 				shrink_zone(priority, zone, &sc);
-
 				reclaim_state->reclaimed_slab = 0;
 				nr_slab = shrink_slab(&shrink, sc.nr_scanned, lru_pages);
 				sc.nr_reclaimed += reclaim_state->reclaimed_slab;
-- 
1.7.7.3

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-15  1:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-11 22:00 [PATCH V2 5/5] memcg: change the target nr_to_reclaim for each memcg under kswapd Ying Han
2012-04-11 23:56 ` Johannes Weiner
2012-04-12  4:06   ` Ying Han
2012-04-12 14:24     ` Johannes Weiner
2012-04-12 16:45       ` Ying Han
2012-04-12 17:44         ` Johannes Weiner
2012-04-12 17:58           ` Ying Han
2012-04-15  1:57 ` Hillf Danton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.