diff options
author | Ying Han <yinghan@google.com> | 2011-05-26 19:25:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-26 20:12:35 -0400 |
commit | 0ae5e89c60c9eb87da36a2614836bc434b0ec2ad (patch) | |
tree | 0d509fd83ac7e7d2f52dfcbba769c43aeeb68b5f /include | |
parent | f042e707ee671e4beb5389abeb9a1819a2cf5532 (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')
-rw-r--r-- | include/linux/memcontrol.h | 6 | ||||
-rw-r--r-- | include/linux/swap.h | 3 |
2 files changed, 6 insertions, 3 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 | ||
146 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 146 | unsigned 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); | ||
148 | u64 mem_cgroup_get_limit(struct mem_cgroup *mem); | 149 | u64 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 | ||
339 | static inline | 340 | static inline |
340 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 341 | unsigned 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 | } |
diff --git a/include/linux/swap.h b/include/linux/swap.h index a5c6da5d8df8..384eb5fe530b 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -257,7 +257,8 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | |||
257 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | 257 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, |
258 | gfp_t gfp_mask, bool noswap, | 258 | gfp_t gfp_mask, bool noswap, |
259 | unsigned int swappiness, | 259 | unsigned int swappiness, |
260 | struct zone *zone); | 260 | struct zone *zone, |
261 | unsigned long *nr_scanned); | ||
261 | extern int __isolate_lru_page(struct page *page, int mode, int file); | 262 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
262 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 263 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
263 | extern int vm_swappiness; | 264 | extern int vm_swappiness; |