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>
This commit is contained in:
parent
8d76a97978
commit
e0743e6bc5
|
@ -299,8 +299,6 @@ struct mem_cgroup {
|
||||||
bool oom_lock;
|
bool oom_lock;
|
||||||
atomic_t under_oom;
|
atomic_t under_oom;
|
||||||
|
|
||||||
atomic_t refcnt;
|
|
||||||
|
|
||||||
int swappiness;
|
int swappiness;
|
||||||
/* OOM-Killer disable */
|
/* OOM-Killer disable */
|
||||||
int oom_kill_disable;
|
int oom_kill_disable;
|
||||||
|
@ -503,8 +501,6 @@ enum res_type {
|
||||||
*/
|
*/
|
||||||
static DEFINE_MUTEX(memcg_create_mutex);
|
static DEFINE_MUTEX(memcg_create_mutex);
|
||||||
|
|
||||||
static void mem_cgroup_put(struct mem_cgroup *memcg);
|
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s)
|
struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s)
|
||||||
{
|
{
|
||||||
|
@ -6238,17 +6234,6 @@ static void free_rcu(struct rcu_head *rcu_head)
|
||||||
schedule_work(&memcg->work_freeing);
|
schedule_work(&memcg->work_freeing);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __mem_cgroup_put(struct mem_cgroup *memcg, int count)
|
|
||||||
{
|
|
||||||
if (atomic_sub_and_test(count, &memcg->refcnt))
|
|
||||||
call_rcu(&memcg->rcu_freeing, free_rcu);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mem_cgroup_put(struct mem_cgroup *memcg)
|
|
||||||
{
|
|
||||||
__mem_cgroup_put(memcg, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the parent mem_cgroup in memcgroup hierarchy with hierarchy enabled.
|
* Returns the parent mem_cgroup in memcgroup hierarchy with hierarchy enabled.
|
||||||
*/
|
*/
|
||||||
|
@ -6308,7 +6293,6 @@ mem_cgroup_css_alloc(struct cgroup *cont)
|
||||||
|
|
||||||
memcg->last_scanned_node = MAX_NUMNODES;
|
memcg->last_scanned_node = MAX_NUMNODES;
|
||||||
INIT_LIST_HEAD(&memcg->oom_notify);
|
INIT_LIST_HEAD(&memcg->oom_notify);
|
||||||
atomic_set(&memcg->refcnt, 1);
|
|
||||||
memcg->move_charge_at_immigrate = 0;
|
memcg->move_charge_at_immigrate = 0;
|
||||||
mutex_init(&memcg->thresholds_lock);
|
mutex_init(&memcg->thresholds_lock);
|
||||||
spin_lock_init(&memcg->move_lock);
|
spin_lock_init(&memcg->move_lock);
|
||||||
|
@ -6399,7 +6383,7 @@ static void mem_cgroup_css_free(struct cgroup *cont)
|
||||||
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
|
struct mem_cgroup *memcg = mem_cgroup_from_cont(cont);
|
||||||
|
|
||||||
memcg_destroy_kmem(memcg);
|
memcg_destroy_kmem(memcg);
|
||||||
__mem_cgroup_free(memcg);
|
call_rcu(&memcg->rcu_freeing, free_rcu);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
|
|
Loading…
Reference in New Issue