.read = mem_cgroup_read,
},
#endif
+ { }, /* terminate */
};
static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node)
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
.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,
};
#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);
cg_proto = tcp_prot.proto_cgroup(memcg);
if (!cg_proto)
- goto create_files;
+ return 0;
tcp = tcp_from_cgproto(cg_proto);
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);
.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);