diff options
-rw-r--r-- | mm/memcontrol.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 785c32367075..901bb03f2ae7 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -4640,7 +4640,7 @@ static int mem_control_numa_stat_open(struct inode *unused, struct file *file) | |||
4640 | #endif /* CONFIG_NUMA */ | 4640 | #endif /* CONFIG_NUMA */ |
4641 | 4641 | ||
4642 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM | 4642 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM |
4643 | static int register_kmem_files(struct mem_cgroup *memcg, struct cgroup_subsys *ss) | 4643 | static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) |
4644 | { | 4644 | { |
4645 | return mem_cgroup_sockets_init(memcg, ss); | 4645 | return mem_cgroup_sockets_init(memcg, ss); |
4646 | }; | 4646 | }; |
@@ -4650,7 +4650,7 @@ static void kmem_cgroup_destroy(struct mem_cgroup *memcg) | |||
4650 | mem_cgroup_sockets_destroy(memcg); | 4650 | mem_cgroup_sockets_destroy(memcg); |
4651 | } | 4651 | } |
4652 | #else | 4652 | #else |
4653 | static int register_kmem_files(struct mem_cgroup *memcg, struct cgroup_subsys *ss) | 4653 | static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) |
4654 | { | 4654 | { |
4655 | return 0; | 4655 | return 0; |
4656 | } | 4656 | } |
@@ -5010,6 +5010,17 @@ mem_cgroup_create(struct cgroup *cont) | |||
5010 | memcg->move_charge_at_immigrate = 0; | 5010 | memcg->move_charge_at_immigrate = 0; |
5011 | mutex_init(&memcg->thresholds_lock); | 5011 | mutex_init(&memcg->thresholds_lock); |
5012 | spin_lock_init(&memcg->move_lock); | 5012 | spin_lock_init(&memcg->move_lock); |
5013 | |||
5014 | error = memcg_init_kmem(memcg, &mem_cgroup_subsys); | ||
5015 | if (error) { | ||
5016 | /* | ||
5017 | * We call put now because our (and parent's) refcnts | ||
5018 | * are already in place. mem_cgroup_put() will internally | ||
5019 | * call __mem_cgroup_free, so return directly | ||
5020 | */ | ||
5021 | mem_cgroup_put(memcg); | ||
5022 | return ERR_PTR(error); | ||
5023 | } | ||
5013 | return &memcg->css; | 5024 | return &memcg->css; |
5014 | free_out: | 5025 | free_out: |
5015 | __mem_cgroup_free(memcg); | 5026 | __mem_cgroup_free(memcg); |
@@ -5032,13 +5043,6 @@ static void mem_cgroup_destroy(struct cgroup *cont) | |||
5032 | mem_cgroup_put(memcg); | 5043 | mem_cgroup_put(memcg); |
5033 | } | 5044 | } |
5034 | 5045 | ||
5035 | static int mem_cgroup_populate(struct cgroup_subsys *ss, | ||
5036 | struct cgroup *cont) | ||
5037 | { | ||
5038 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | ||
5039 | return register_kmem_files(memcg, ss); | ||
5040 | } | ||
5041 | |||
5042 | #ifdef CONFIG_MMU | 5046 | #ifdef CONFIG_MMU |
5043 | /* Handlers for move charge at task migration. */ | 5047 | /* Handlers for move charge at task migration. */ |
5044 | #define PRECHARGE_COUNT_AT_ONCE 256 | 5048 | #define PRECHARGE_COUNT_AT_ONCE 256 |
@@ -5622,7 +5626,6 @@ struct cgroup_subsys mem_cgroup_subsys = { | |||
5622 | .create = mem_cgroup_create, | 5626 | .create = mem_cgroup_create, |
5623 | .pre_destroy = mem_cgroup_pre_destroy, | 5627 | .pre_destroy = mem_cgroup_pre_destroy, |
5624 | .destroy = mem_cgroup_destroy, | 5628 | .destroy = mem_cgroup_destroy, |
5625 | .populate = mem_cgroup_populate, | ||
5626 | .can_attach = mem_cgroup_can_attach, | 5629 | .can_attach = mem_cgroup_can_attach, |
5627 | .cancel_attach = mem_cgroup_cancel_attach, | 5630 | .cancel_attach = mem_cgroup_cancel_attach, |
5628 | .attach = mem_cgroup_move_task, | 5631 | .attach = mem_cgroup_move_task, |