diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2009-12-16 06:19:59 -0500 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2009-12-16 06:19:59 -0500 |
commit | d324236b3333e87c8825b35f2104184734020d35 (patch) | |
tree | e8ad6b50e50f975b692cc6a15d5812a51d0047ad | |
parent | e42d9d5d47961fb5db0be65b56dd52fe7b2421f1 (diff) |
memcg: add accessor to mem_cgroup.css
So that an outside user can free the reference count grabbed by
try_get_mem_cgroup_from_page().
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Hugh Dickins <hugh.dickins@tiscali.co.uk>
CC: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
CC: Balbir Singh <balbir@linux.vnet.ibm.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | include/linux/memcontrol.h | 7 | ||||
-rw-r--r-- | mm/memcontrol.c | 5 |
2 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index fc9bae82ac4..2c30a1116d8 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -81,6 +81,8 @@ int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) | |||
81 | return cgroup == mem; | 81 | return cgroup == mem; |
82 | } | 82 | } |
83 | 83 | ||
84 | extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem); | ||
85 | |||
84 | extern int | 86 | extern int |
85 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); | 87 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr); |
86 | extern void mem_cgroup_end_migration(struct mem_cgroup *mem, | 88 | extern void mem_cgroup_end_migration(struct mem_cgroup *mem, |
@@ -206,6 +208,11 @@ static inline int task_in_mem_cgroup(struct task_struct *task, | |||
206 | return 1; | 208 | return 1; |
207 | } | 209 | } |
208 | 210 | ||
211 | static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem) | ||
212 | { | ||
213 | return NULL; | ||
214 | } | ||
215 | |||
209 | static inline int | 216 | static inline int |
210 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) | 217 | mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr) |
211 | { | 218 | { |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b5ac61ce734..9eee80d6d49 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -282,6 +282,11 @@ mem_cgroup_zoneinfo(struct mem_cgroup *mem, int nid, int zid) | |||
282 | return &mem->info.nodeinfo[nid]->zoneinfo[zid]; | 282 | return &mem->info.nodeinfo[nid]->zoneinfo[zid]; |
283 | } | 283 | } |
284 | 284 | ||
285 | struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem) | ||
286 | { | ||
287 | return &mem->css; | ||
288 | } | ||
289 | |||
285 | static struct mem_cgroup_per_zone * | 290 | static struct mem_cgroup_per_zone * |
286 | page_cgroup_zoneinfo(struct page_cgroup *pc) | 291 | page_cgroup_zoneinfo(struct page_cgroup *pc) |
287 | { | 292 | { |