cgroup_name() returns the name of a cgroup and it must be called with rcu_read_lock() held. This will be used by cpuset. Signed-off-by: Li Zefan <lizefan@xxxxxxxxxx> --- include/linux/cgroup.h | 1 + kernel/cgroup.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 7f21bad..70676eb 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -426,6 +426,7 @@ int cgroup_rm_cftypes(struct cgroup_subsys *ss, struct cftype *cfts); int cgroup_is_removed(const struct cgroup *cgrp); +char *cgroup_name(const struct cgroup *cgrp); int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); int cgroup_task_count(const struct cgroup *cgrp); diff --git a/kernel/cgroup.c b/kernel/cgroup.c index eb3c280..abbb097 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1778,6 +1778,20 @@ static struct file_system_type cgroup_fs_type = { static struct kobject *cgroup_kobj; /** + * cgroup_name - get the name of a cgroup + * @cgrp: the cgroup in question + * + * Must be called with rcu_read_lock() held. + */ +char *cgroup_name(const struct cgroup *cgrp) +{ + if (!cgrp->parent) + return "/"; + else + return rcu_dereference(cgrp->name)->name; +} + +/** * cgroup_path - generate the path of a cgroup * @cgrp: the cgroup in question * @buf: the buffer to write the path into -- 1.8.0.2 -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html