diff options
author | Li Zefan <lizefan@huawei.com> | 2013-07-08 19:00:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-09 13:33:24 -0400 |
commit | e0743e6bc5b7587dd0bfa902d67d3f81ef3f6618 (patch) | |
tree | a87f9720beb40eac10d247feead74ae9a77c80e6 /mm/memcontrol.c | |
parent | 8d76a9797882fc517d87e2b5db2a4f04edaeccec (diff) |
memcg: kill memcg refcnt
Now memcg has the same life cycle as its corresponding cgroup. Kill the
useless refcnt.
Signed-off-by: Li Zefan <lizefan@huawei.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Glauber Costa <glommer@openvz.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c508258d61a1..fa521a2f4bf6 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -299,8 +299,6 @@ struct mem_cgroup { | |||
299 | bool oom_lock; | 299 | bool oom_lock; |
300 | atomic_t under_oom; | 300 | atomic_t under_oom; |
301 | 301 | ||
302 | atomic_t refcnt; | ||
303 | |||
304 | int swappiness; | 302 | int swappiness; |
305 | /* OOM-Killer disable */ | 303 | /* OOM-Killer disable */ |
306 | int oom_kill_disable; | 304 | int oom_kill_disable; |
@@ -503,8 +501,6 @@ enum res_type { | |||
503 | */ | 501 | */ |
504 | static DEFINE_MUTEX(memcg_create_mutex); | 502 | static DEFINE_MUTEX(memcg_create_mutex); |
505 | 503 | ||
506 | static void mem_cgroup_put(struct mem_cgroup *memcg); | ||
507 | |||
508 | static inline | 504 | static inline |
509 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) | 505 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) |
510 | { | 506 | { |
@@ -6238,17 +6234,6 @@ static void free_rcu(struct rcu_head *rcu_head) | |||
6238 | schedule_work(&memcg->work_freeing); | 6234 | schedule_work(&memcg->work_freeing); |
6239 | } | 6235 | } |
6240 | 6236 | ||
6241 | static void __mem_cgroup_put(struct mem_cgroup *memcg, int count) | ||
6242 | { | ||
6243 | if (atomic_sub_and_test(count, &memcg->refcnt)) | ||
6244 | call_rcu(&memcg->rcu_freeing, free_rcu); | ||
6245 | } | ||
6246 | |||
6247 | static void mem_cgroup_put(struct mem_cgroup *memcg) | ||
6248 | { | ||
6249 | __mem_cgroup_put(memcg, 1); | ||
6250 | } | ||
6251 | |||
6252 | /* | 6237 | /* |
6253 | * Returns the parent mem_cgroup in memcgroup hierarchy with hierarchy enabled. | 6238 | * Returns the parent mem_cgroup in memcgroup hierarchy with hierarchy enabled. |
6254 | */ | 6239 | */ |
@@ -6308,7 +6293,6 @@ mem_cgroup_css_alloc(struct cgroup *cont) | |||
6308 | 6293 | ||
6309 | memcg->last_scanned_node = MAX_NUMNODES; | 6294 | memcg->last_scanned_node = MAX_NUMNODES; |
6310 | INIT_LIST_HEAD(&memcg->oom_notify); | 6295 | INIT_LIST_HEAD(&memcg->oom_notify); |
6311 | atomic_set(&memcg->refcnt, 1); | ||
6312 | memcg->move_charge_at_immigrate = 0; | 6296 | memcg->move_charge_at_immigrate = 0; |
6313 | mutex_init(&memcg->thresholds_lock); | 6297 | mutex_init(&memcg->thresholds_lock); |
6314 | spin_lock_init(&memcg->move_lock); | 6298 | spin_lock_init(&memcg->move_lock); |
@@ -6399,7 +6383,7 @@ static void mem_cgroup_css_free(struct cgroup *cont) | |||
6399 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 6383 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); |
6400 | 6384 | ||
6401 | memcg_destroy_kmem(memcg); | 6385 | memcg_destroy_kmem(memcg); |
6402 | __mem_cgroup_free(memcg); | 6386 | call_rcu(&memcg->rcu_freeing, free_rcu); |
6403 | } | 6387 | } |
6404 | 6388 | ||
6405 | #ifdef CONFIG_MMU | 6389 | #ifdef CONFIG_MMU |