diff options
author | Tejun Heo <tj@kernel.org> | 2012-04-01 21:09:55 +0200 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-04-01 21:09:55 +0200 |
commit | 6bc103498f5fe512928496fc7802d639cc2d1d20 (patch) | |
tree | 15a9628ff89b48889ab7cf81822d689e0173ca2b /net/ipv4 | |
parent | memcg: always create memsw files if CONFIG_CGROUP_MEM_RES_CTLR_SWAP (diff) | |
download | linux-6bc103498f5fe512928496fc7802d639cc2d1d20.tar.xz linux-6bc103498f5fe512928496fc7802d639cc2d1d20.zip |
cgroup: convert memcg controller to the new cftype interface
Convert memcg to use the new cftype based interface. kmem support
abuses ->populate() for mem_cgroup_sockets_init() so it can't be
removed at the moment.
tcp_memcontrol is updated so that tcp_files[] is registered via a
__initcall. This change also allows removing the forward declaration
of tcp_files[]. Removed.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Greg Thelen <gthelen@google.com>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp_memcontrol.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index 4d3ee407d2d8..8f1753defa5c 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c @@ -6,8 +6,6 @@ #include <linux/memcontrol.h> #include <linux/module.h> -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); |