From 991e46ad8c20b3b78f1fa33387374b2a993dbcec Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Mon, 9 Apr 2012 19:36:34 -0300 Subject: [PATCH] --- yaml --- r: 304799 b: refs/heads/master c: cbe128e348e5994516304f94865ff90c40c1c5ae h: refs/heads/master i: 304797: fdd2997dccdeeb1cf1dd24bc901b3c1017f0ca0f 304795: edaef68c655bf1349760ea4feae73c391cd7ccaa 304791: 2cef639962a41efc4f74fb11c388c492081c1f2b 304783: 1a85d51dc3ae34ce6656d82445e1ed3f143cc214 304767: ba50af8d72ea9d36b1fd49d24b190d7267909dd7 v: v3 --- [refs] | 2 +- trunk/mm/memcontrol.c | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 8a7f9da1b07e..4c83c5e1842d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1d62e43657c63a858560c98069706c705d20505d +refs/heads/master: cbe128e348e5994516304f94865ff90c40c1c5ae diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index 785c32367075..901bb03f2ae7 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -4640,7 +4640,7 @@ static int mem_control_numa_stat_open(struct inode *unused, struct file *file) #endif /* CONFIG_NUMA */ #ifdef CONFIG_CGROUP_MEM_RES_CTLR_KMEM -static int register_kmem_files(struct mem_cgroup *memcg, struct cgroup_subsys *ss) +static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) { return mem_cgroup_sockets_init(memcg, ss); }; @@ -4650,7 +4650,7 @@ static void kmem_cgroup_destroy(struct mem_cgroup *memcg) mem_cgroup_sockets_destroy(memcg); } #else -static int register_kmem_files(struct mem_cgroup *memcg, struct cgroup_subsys *ss) +static int memcg_init_kmem(struct mem_cgroup *memcg, struct cgroup_subsys *ss) { return 0; } @@ -5010,6 +5010,17 @@ mem_cgroup_create(struct cgroup *cont) memcg->move_charge_at_immigrate = 0; mutex_init(&memcg->thresholds_lock); spin_lock_init(&memcg->move_lock); + + error = memcg_init_kmem(memcg, &mem_cgroup_subsys); + if (error) { + /* + * We call put now because our (and parent's) refcnts + * are already in place. mem_cgroup_put() will internally + * call __mem_cgroup_free, so return directly + */ + mem_cgroup_put(memcg); + return ERR_PTR(error); + } return &memcg->css; free_out: __mem_cgroup_free(memcg); @@ -5032,13 +5043,6 @@ static void mem_cgroup_destroy(struct cgroup *cont) mem_cgroup_put(memcg); } -static int mem_cgroup_populate(struct cgroup_subsys *ss, - struct cgroup *cont) -{ - struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); - return register_kmem_files(memcg, ss); -} - #ifdef CONFIG_MMU /* Handlers for move charge at task migration. */ #define PRECHARGE_COUNT_AT_ONCE 256 @@ -5622,7 +5626,6 @@ struct cgroup_subsys mem_cgroup_subsys = { .create = mem_cgroup_create, .pre_destroy = mem_cgroup_pre_destroy, .destroy = mem_cgroup_destroy, - .populate = mem_cgroup_populate, .can_attach = mem_cgroup_can_attach, .cancel_attach = mem_cgroup_cancel_attach, .attach = mem_cgroup_move_task,