aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorYing Han <yinghan@google.com>2011-05-26 19:25:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-26 20:12:35 -0400
commit0ae5e89c60c9eb87da36a2614836bc434b0ec2ad (patch)
tree0d509fd83ac7e7d2f52dfcbba769c43aeeb68b5f /include/linux/memcontrol.h
parentf042e707ee671e4beb5389abeb9a1819a2cf5532 (diff)
memcg: count the soft_limit reclaim in global background reclaim
The global kswapd scans per-zone LRU and reclaims pages regardless of the cgroup. It breaks memory isolation since one cgroup can end up reclaiming pages from another cgroup. Instead we should rely on memcg-aware target reclaim including per-memcg kswapd and soft_limit hierarchical reclaim under memory pressure. In the global background reclaim, we do soft reclaim before scanning the per-zone LRU. However, the return value is ignored. This patch is the first step to skip shrink_zone() if soft_limit reclaim does enough work. This is part of the effort which tries to reduce reclaiming pages in global LRU in memcg. The per-memcg background reclaim patchset further enhances the per-cgroup targetting reclaim, which I should have V4 posted shortly. Try running multiple memory intensive workloads within seperate memcgs. Watch the counters of soft_steal in memory.stat. $ cat /dev/cgroup/A/memory.stat | grep 'soft' soft_steal 240000 soft_scan 240000 total_soft_steal 240000 total_soft_scan 240000 This patch: In the global background reclaim, we do soft reclaim before scanning the per-zone LRU. However, the return value is ignored. We would like to skip shrink_zone() if soft_limit reclaim does enough work. Also, we need to make the memory pressure balanced across per-memcg zones, like the logic vm-core. This patch is the first step where we start with counting the nr_scanned and nr_reclaimed from soft_limit reclaim into the 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: Rik van Riel <riel@redhat.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 5e9840f50980..0629121f2c0b 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -144,7 +144,8 @@ static inline void mem_cgroup_dec_page_stat(struct page *page,
144} 144}
145 145
146unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 146unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
147 gfp_t gfp_mask); 147 gfp_t gfp_mask,
148 unsigned long *total_scanned);
148u64 mem_cgroup_get_limit(struct mem_cgroup *mem); 149u64 mem_cgroup_get_limit(struct mem_cgroup *mem);
149 150
150#ifdef CONFIG_TRANSPARENT_HUGEPAGE 151#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -338,7 +339,8 @@ static inline void mem_cgroup_dec_page_stat(struct page *page,
338 339
339static inline 340static inline
340unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, 341unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
341 gfp_t gfp_mask) 342 gfp_t gfp_mask,
343 unsigned long *total_scanned)
342{ 344{
343 return 0; 345 return 0;
344} 346}