aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorYing Han <yinghan@google.com>2011-05-26 19:25:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 20:12:35 -0400
commitd149e3b25d7c5f33de9aa866303926fa53535aa7 (patch)
tree160c8c3136246921458c96ab8257381d702208aa /mm/vmscan.c
parent0ae5e89c60c9eb87da36a2614836bc434b0ec2ad (diff)
memcg: add the soft_limit reclaim in global direct reclaim.
We recently added the change in global background reclaim which counts the return value of soft_limit reclaim. Now this patch adds the similar logic on global direct reclaim. We should skip scanning global LRU on shrink_zone if soft_limit reclaim does enough work. This is the first step where we start with counting the nr_scanned and nr_reclaimed from soft_limit reclaim into global scan_control. Signed-off-by: Ying Han <yinghan@google.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Minchan Kim <minchan.kim@gmail.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Rik van Riel <riel@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Michal Hocko <mhocko@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9ce6ec84328e..884ae08c16cc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1977,11 +1977,14 @@ restart:
1977 * If a zone is deemed to be full of pinned pages then just give it a light 1977 * If a zone is deemed to be full of pinned pages then just give it a light
1978 * scan then give up on it. 1978 * scan then give up on it.
1979 */ 1979 */
1980static void shrink_zones(int priority, struct zonelist *zonelist, 1980static unsigned long shrink_zones(int priority, struct zonelist *zonelist,
1981 struct scan_control *sc) 1981 struct scan_control *sc)
1982{ 1982{
1983 struct zoneref *z; 1983 struct zoneref *z;
1984 struct zone *zone; 1984 struct zone *zone;
1985 unsigned long nr_soft_reclaimed;
1986 unsigned long nr_soft_scanned;
1987 unsigned long total_scanned = 0;
1985 1988
1986 for_each_zone_zonelist_nodemask(zone, z, zonelist, 1989 for_each_zone_zonelist_nodemask(zone, z, zonelist,
1987 gfp_zone(sc->gfp_mask), sc->nodemask) { 1990 gfp_zone(sc->gfp_mask), sc->nodemask) {
@@ -1998,8 +2001,17 @@ static void shrink_zones(int priority, struct zonelist *zonelist,
1998 continue; /* Let kswapd poll it */ 2001 continue; /* Let kswapd poll it */
1999 } 2002 }
2000 2003
2004 nr_soft_scanned = 0;
2005 nr_soft_reclaimed = mem_cgroup_soft_limit_reclaim(zone,
2006 sc->order, sc->gfp_mask,
2007 &nr_soft_scanned);
2008 sc->nr_reclaimed += nr_soft_reclaimed;
2009 total_scanned += nr_soft_scanned;
2010
2001 shrink_zone(priority, zone, sc); 2011 shrink_zone(priority, zone, sc);
2002 } 2012 }
2013
2014 return total_scanned;
2003} 2015}
2004 2016
2005static bool zone_reclaimable(struct zone *zone) 2017static bool zone_reclaimable(struct zone *zone)
@@ -2064,7 +2076,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist,
2064 sc->nr_scanned = 0; 2076 sc->nr_scanned = 0;
2065 if (!priority) 2077 if (!priority)
2066 disable_swap_token(); 2078 disable_swap_token();
2067 shrink_zones(priority, zonelist, sc); 2079 total_scanned += shrink_zones(priority, zonelist, sc);
2068 /* 2080 /*
2069 * Don't shrink slabs when reclaiming memory from 2081 * Don't shrink slabs when reclaiming memory from
2070 * over limit cgroups 2082 * over limit cgroups