[RFC 3/3] Do not shrink isolated groups from the global reclaim

From: Michal Hocko
Date: Mon Mar 28 2011 - 05:41:10 EST


Pages charged for isolated mem cgroups are not placed on the global LRU
lists so they are protected from the reclaim in general. This is still not
enough as they still can get reclaimed during the soft hierarchical reclaim

balance_pgdat
mem_cgroup_soft_limit_reclaim
mem_cgroup_hierarchical_reclaim
mem_cgroup_shrink_node_zone

Let's prevent from soft reclaim if the group isolated and let's defer its
balancing to try_to_free_mem_cgroup_pages called from charging paths. This
will make allocations for the group more oom-prone probably but the group
wanted to be isolated so we should give it as much of isolation as it gets
and let the proper memory usage to the group user.

Signed-off-by: Michal Hocko <mhocko@xxxxxxx>

---
vmscan.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

Index: linux-2.6.38-rc8/mm/vmscan.c
===================================================================
--- linux-2.6.38-rc8.orig/mm/vmscan.c 2011-03-28 11:24:20.000000000 +0200
+++ linux-2.6.38-rc8/mm/vmscan.c 2011-03-28 11:24:38.000000000 +0200
@@ -2170,14 +2170,16 @@ unsigned long mem_cgroup_shrink_node_zon
sc.may_writepage,
sc.gfp_mask);

- /*
- * NOTE: Although we can get the priority field, using it
- * here is not a good idea, since it limits the pages we can scan.
- * if we don't reclaim here, the shrink_zone from balance_pgdat
- * will pick up pages from other mem cgroup's as well. We hack
- * the priority and make it zero.
- */
- shrink_zone(0, zone, &sc);
+ if (!is_mem_cgroup_isolated(mem)) {
+ /*
+ * NOTE: Although we can get the priority field, using it
+ * here is not a good idea, since it limits the pages we can scan.
+ * if we don't reclaim here, the shrink_zone from balance_pgdat
+ * will pick up pages from other mem cgroup's as well. We hack
+ * the priority and make it zero.
+ */
+ shrink_zone(0, zone, &sc);
+ }

trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed);



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/