diff options
author | Johannes Weiner <jweiner@redhat.com> | 2012-01-12 20:17:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-12 23:13:05 -0500 |
commit | 5660048ccac8735d9bc0a46325a02e6a6518b5b2 (patch) | |
tree | 4b2269ddd6ca001843187a89fb91278192028d87 /include/linux/memcontrol.h | |
parent | 527a5ec9a53471d855291ba9f1fdf1dd4e12a184 (diff) |
mm: move memcg hierarchy reclaim to generic reclaim code
Memory cgroup limit reclaim and traditional global pressure reclaim will
soon share the same code to reclaim from a hierarchical tree of memory
cgroups.
In preparation of this, move the two right next to each other in
shrink_zone().
The mem_cgroup_hierarchical_reclaim() polymath is split into a soft
limit reclaim function, which still does hierarchy walking on its own,
and a limit (shrinking) reclaim function, which relies on generic
reclaim code to walk the hierarchy.
Signed-off-by: Johannes Weiner <jweiner@redhat.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Ying Han <yinghan@google.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hughd@google.com>
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.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 3558a5e268cf..3b99dce85293 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -40,6 +40,12 @@ extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, | |||
40 | struct mem_cgroup *mem_cont, | 40 | struct mem_cgroup *mem_cont, |
41 | int active, int file); | 41 | int active, int file); |
42 | 42 | ||
43 | struct mem_cgroup_reclaim_cookie { | ||
44 | struct zone *zone; | ||
45 | int priority; | ||
46 | unsigned int generation; | ||
47 | }; | ||
48 | |||
43 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR | 49 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR |
44 | /* | 50 | /* |
45 | * All "charge" functions with gfp_mask should use GFP_KERNEL or | 51 | * All "charge" functions with gfp_mask should use GFP_KERNEL or |
@@ -106,6 +112,11 @@ mem_cgroup_prepare_migration(struct page *page, | |||
106 | extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, | 112 | extern void mem_cgroup_end_migration(struct mem_cgroup *memcg, |
107 | struct page *oldpage, struct page *newpage, bool migration_ok); | 113 | struct page *oldpage, struct page *newpage, bool migration_ok); |
108 | 114 | ||
115 | struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *, | ||
116 | struct mem_cgroup *, | ||
117 | struct mem_cgroup_reclaim_cookie *); | ||
118 | void mem_cgroup_iter_break(struct mem_cgroup *, struct mem_cgroup *); | ||
119 | |||
109 | /* | 120 | /* |
110 | * For memory reclaim. | 121 | * For memory reclaim. |
111 | */ | 122 | */ |
@@ -281,6 +292,19 @@ static inline void mem_cgroup_end_migration(struct mem_cgroup *memcg, | |||
281 | { | 292 | { |
282 | } | 293 | } |
283 | 294 | ||
295 | static inline struct mem_cgroup * | ||
296 | mem_cgroup_iter(struct mem_cgroup *root, | ||
297 | struct mem_cgroup *prev, | ||
298 | struct mem_cgroup_reclaim_cookie *reclaim) | ||
299 | { | ||
300 | return NULL; | ||
301 | } | ||
302 | |||
303 | static inline void mem_cgroup_iter_break(struct mem_cgroup *root, | ||
304 | struct mem_cgroup *prev) | ||
305 | { | ||
306 | } | ||
307 | |||
284 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) | 308 | static inline int mem_cgroup_get_reclaim_priority(struct mem_cgroup *memcg) |
285 | { | 309 | { |
286 | return 0; | 310 | return 0; |