From 2cef639962a41efc4f74fb11c388c492081c1f2b Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sun, 1 Apr 2012 12:09:55 -0700 Subject: [PATCH] --- yaml --- r: 304791 b: refs/heads/master c: 6bc103498f5fe512928496fc7802d639cc2d1d20 h: refs/heads/master i: 304789: e5de6911f80c46e9ee9c4a2426584308dd2025a9 304787: 3d8bb2916868a328a1ae9955ffe6143447204114 304783: 1a85d51dc3ae34ce6656d82445e1ed3f143cc214 v: v3 --- [refs] | 2 +- trunk/mm/memcontrol.c | 12 +++--------- trunk/net/ipv4/tcp_memcontrol.c | 16 ++++++++++------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/[refs] b/[refs] index 6e7a4ff6754b..405d489cf90a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: af36f906c0f4c2ffa0482ecdf856a33dc88ae8c5 +refs/heads/master: 6bc103498f5fe512928496fc7802d639cc2d1d20 diff --git a/trunk/mm/memcontrol.c b/trunk/mm/memcontrol.c index 97a45b392f77..bef114258bbd 100644 --- a/trunk/mm/memcontrol.c +++ b/trunk/mm/memcontrol.c @@ -4764,6 +4764,7 @@ static struct cftype mem_cgroup_files[] = { .read = mem_cgroup_read, }, #endif + { }, /* terminate */ }; static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node) @@ -5041,15 +5042,7 @@ static void mem_cgroup_destroy(struct cgroup *cont) static int mem_cgroup_populate(struct cgroup_subsys *ss, struct cgroup *cont) { - int ret; - - ret = cgroup_add_files(cont, ss, mem_cgroup_files, - ARRAY_SIZE(mem_cgroup_files)); - - if (!ret) - ret = register_kmem_files(cont, ss); - - return ret; + return register_kmem_files(cont, ss); } #ifdef CONFIG_MMU @@ -5639,6 +5632,7 @@ struct cgroup_subsys mem_cgroup_subsys = { .can_attach = mem_cgroup_can_attach, .cancel_attach = mem_cgroup_cancel_attach, .attach = mem_cgroup_move_task, + .base_cftypes = mem_cgroup_files, .early_init = 0, .use_id = 1, }; diff --git a/trunk/net/ipv4/tcp_memcontrol.c b/trunk/net/ipv4/tcp_memcontrol.c index 4d3ee407d2d8..8f1753defa5c 100644 --- a/trunk/net/ipv4/tcp_memcontrol.c +++ b/trunk/net/ipv4/tcp_memcontrol.c @@ -6,8 +6,6 @@ #include #include -static struct cftype tcp_files[4]; /* XXX: will be removed soon */ - static inline struct tcp_memcontrol *tcp_from_cgproto(struct cg_proto *cg_proto) { return container_of(cg_proto, struct tcp_memcontrol, cg_proto); @@ -36,7 +34,7 @@ int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss) cg_proto = tcp_prot.proto_cgroup(memcg); if (!cg_proto) - goto create_files; + return 0; tcp = tcp_from_cgproto(cg_proto); @@ -59,9 +57,7 @@ int tcp_init_cgroup(struct cgroup *cgrp, struct cgroup_subsys *ss) cg_proto->sockets_allocated = &tcp->tcp_sockets_allocated; cg_proto->memcg = memcg; -create_files: - return cgroup_add_files(cgrp, ss, tcp_files, - ARRAY_SIZE(tcp_files)); + return 0; } EXPORT_SYMBOL(tcp_init_cgroup); @@ -266,4 +262,12 @@ static struct cftype tcp_files[] = { .trigger = tcp_cgroup_reset, .read_u64 = tcp_cgroup_read, }, + { } /* terminate */ }; + +static int __init tcp_memcontrol_init(void) +{ + WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys, tcp_files)); + return 0; +} +__initcall(tcp_memcontrol_init);