linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: vmscan: check mem cgroup over reclaimed
@ 2012-01-23  1:55 Hillf Danton
  2012-01-23 10:47 ` Johannes Weiner
  2012-01-23 19:04 ` Ying Han
  0 siblings, 2 replies; 12+ messages in thread
From: Hillf Danton @ 2012-01-23  1:55 UTC (permalink / raw)
  To: linux-mm
  Cc: Michal Hocko, KAMEZAWA Hiroyuki, Ying Han, Hugh Dickins,
	Andrew Morton, LKML, Hillf Danton

To avoid reduction in performance of reclaimee, checking overreclaim is added
after shrinking lru list, when pages are reclaimed from mem cgroup.

If over reclaim occurs, shrinking remaining lru lists is skipped, and no more
reclaim for reclaim/compaction.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/vmscan.c	Mon Jan 23 00:23:10 2012
+++ b/mm/vmscan.c	Mon Jan 23 09:57:20 2012
@@ -2086,6 +2086,7 @@ static void shrink_mem_cgroup_zone(int p
 	unsigned long nr_reclaimed, nr_scanned;
 	unsigned long nr_to_reclaim = sc->nr_to_reclaim;
 	struct blk_plug plug;
+	bool memcg_over_reclaimed = false;

 restart:
 	nr_reclaimed = 0;
@@ -2103,6 +2104,11 @@ restart:

 				nr_reclaimed += shrink_list(lru, nr_to_scan,
 							    mz, sc, priority);
+
+				memcg_over_reclaimed = !scanning_global_lru(mz)
+					&& (nr_reclaimed >= nr_to_reclaim);
+				if (memcg_over_reclaimed)
+					goto out;
 			}
 		}
 		/*
@@ -2116,6 +2122,7 @@ restart:
 		if (nr_reclaimed >= nr_to_reclaim && priority < DEF_PRIORITY)
 			break;
 	}
+out:
 	blk_finish_plug(&plug);
 	sc->nr_reclaimed += nr_reclaimed;

@@ -2127,7 +2134,8 @@ restart:
 		shrink_active_list(SWAP_CLUSTER_MAX, mz, sc, priority, 0);

 	/* reclaim/compaction might need reclaim to continue */
-	if (should_continue_reclaim(mz, nr_reclaimed,
+	if (!memcg_over_reclaimed &&
+	    should_continue_reclaim(mz, nr_reclaimed,
 					sc->nr_scanned - nr_scanned, sc))
 		goto restart;

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

end of thread, other threads:[~2012-01-26  9:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23  1:55 [PATCH] mm: vmscan: check mem cgroup over reclaimed Hillf Danton
2012-01-23 10:47 ` Johannes Weiner
2012-01-23 12:30   ` Hillf Danton
2012-01-24  8:33     ` Johannes Weiner
2012-01-24  9:08       ` KAMEZAWA Hiroyuki
2012-01-24 23:33         ` Ying Han
2012-01-26  9:16           ` KAMEZAWA Hiroyuki
2012-01-23 19:04 ` Ying Han
2012-01-24  3:45   ` Hillf Danton
2012-01-24 23:22     ` Ying Han
2012-01-25  1:47       ` Hillf Danton
2012-01-25 19:20         ` Ying Han

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