[Devel] [PATCH 3/4] provide a function to register more cftype files into memcg
Glauber Costa
glommer at parallels.com
Tue Mar 20 09:50:55 PDT 2012
The function mem_cgroup_register_cftype() is provided here, so
an optional memcg subsystem that needs to register files at
a time later than memcg initialization can do it.
Signed-off-by: Glauber Costa <glommer at parallels.com>
CC: Tejun Heo <tj at kernel.org>
CC: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
---
include/linux/memcontrol.h | 1 +
mm/memcontrol.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 4d34356..bcf8de3 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -141,6 +141,7 @@ static inline bool mem_cgroup_disabled(void)
return false;
}
+int mem_cgroup_register_cftype(const struct cftype *cfts);
void mem_cgroup_update_page_stat(struct page *page,
enum mem_cgroup_page_stat_item idx,
int val);
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f7c6727..bd91a46 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -444,6 +444,12 @@ struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg)
return &memcg->css;
}
+int mem_cgroup_register_cftype(const struct cftype *cfts)
+{
+ return WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys, cfts));
+}
+EXPORT_SYMBOL(mem_cgroup_register_cftype);
+
static struct mem_cgroup_per_zone *
page_cgroup_zoneinfo(struct mem_cgroup *memcg, struct page *page)
{
--
1.7.7.6
More information about the Devel
mailing list