Commit d324236b3333e87c8825b35f2104184734020d35

Authored by Wu Fengguang
Committed by Andi Kleen
1 parent e42d9d5d47

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>

Showing 2 changed files with 12 additions and 0 deletions Side-by-side Diff

include/linux/memcontrol.h
... ... @@ -81,6 +81,8 @@
81 81 return cgroup == mem;
82 82 }
83 83  
  84 +extern struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem);
  85 +
84 86 extern int
85 87 mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
86 88 extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
... ... @@ -204,6 +206,11 @@
204 206 const struct mem_cgroup *mem)
205 207 {
206 208 return 1;
  209 +}
  210 +
  211 +static inline struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *mem)
  212 +{
  213 + return NULL;
207 214 }
208 215  
209 216 static inline int
... ... @@ -282,6 +282,11 @@
282 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 290 static struct mem_cgroup_per_zone *
286 291 page_cgroup_zoneinfo(struct page_cgroup *pc)
287 292 {