diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-08-16 17:40:23 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-08-16 17:40:23 +0200 |
commit | d3ec3a1fd08f705d1b319db4113590944bcde749 (patch) | |
tree | 598a0da59e027b455f11beab24a96ef1e56fbbcb /kernel/cgroup.c | |
parent | 8f898fbbe5ee5e20a77c4074472a1fd088dc47d1 (diff) | |
parent | d4e4ab86bcba5a72779c43dc1459f71fea3d89c8 (diff) | |
download | kernel_goldelico_gta04-d3ec3a1fd08f705d1b319db4113590944bcde749.zip kernel_goldelico_gta04-d3ec3a1fd08f705d1b319db4113590944bcde749.tar.gz kernel_goldelico_gta04-d3ec3a1fd08f705d1b319db4113590944bcde749.tar.bz2 |
Merge tag 'v3.11-rc5' into sched/core
Merge Linux 3.11-rc5, to pick up the latest fixes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 0e0b20b..781845a 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1845,36 +1845,43 @@ out: EXPORT_SYMBOL_GPL(cgroup_path); /** - * task_cgroup_path_from_hierarchy - cgroup path of a task on a hierarchy + * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy * @task: target task - * @hierarchy_id: the hierarchy to look up @task's cgroup from * @buf: the buffer to write the path into * @buflen: the length of the buffer * - * Determine @task's cgroup on the hierarchy specified by @hierarchy_id and - * copy its path into @buf. This function grabs cgroup_mutex and shouldn't - * be used inside locks used by cgroup controller callbacks. + * Determine @task's cgroup on the first (the one with the lowest non-zero + * hierarchy_id) cgroup hierarchy and copy its path into @buf. This + * function grabs cgroup_mutex and shouldn't be used inside locks used by + * cgroup controller callbacks. + * + * Returns 0 on success, fails with -%ENAMETOOLONG if @buflen is too short. */ -int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id, - char *buf, size_t buflen) +int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen) { struct cgroupfs_root *root; - struct cgroup *cgrp = NULL; - int ret = -ENOENT; + struct cgroup *cgrp; + int hierarchy_id = 1, ret = 0; + + if (buflen < 2) + return -ENAMETOOLONG; mutex_lock(&cgroup_mutex); - root = idr_find(&cgroup_hierarchy_idr, hierarchy_id); + root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id); + if (root) { cgrp = task_cgroup_from_root(task, root); ret = cgroup_path(cgrp, buf, buflen); + } else { + /* if no hierarchy exists, everyone is in "/" */ + memcpy(buf, "/", 2); } mutex_unlock(&cgroup_mutex); - return ret; } -EXPORT_SYMBOL_GPL(task_cgroup_path_from_hierarchy); +EXPORT_SYMBOL_GPL(task_cgroup_path); /* * Control Group taskset @@ -4328,8 +4335,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry, } err = percpu_ref_init(&css->refcnt, css_release); - if (err) + if (err) { + ss->css_free(cgrp); goto err_free_all; + } init_cgroup_css(css, ss, cgrp); |