diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-23 18:48:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-23 18:48:35 -0400 |
commit | c2468d32f5a57298b732826af84cdc39745d179c (patch) | |
tree | adcb5668dbe43a173002f23107e3df8d2a1be396 /kernel | |
parent | 549f3a1218ba18fcde11ef0e22b07e6365645788 (diff) | |
parent | 913ffdb54366f94eec65c656cae8c6e00e1ab1b0 (diff) |
Merge branch 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup changes from Tejun Heo:
"This contains two patches, both of which aren't fixes per-se but I
think it'd be better to fast-track them.
One removes bcache_subsys_id which was added without proper review
through the block tree. Fortunately, bcache cgroup code is
unconditionally disabled, so this was never exposed to userland. The
cgroup subsys_id is removed. Kent will remove the affected (disabled)
code through bcache branch.
The other simplifies task_group_path_from_hierarchy(). The function
doesn't currently have in-kernel users but there are external code and
development going on dependent on the function and making the function
available for 3.11 would make things go smoother"
* 'for-3.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
cgroup: replace task_cgroup_path_from_hierarchy() with task_cgroup_path()
cgroup: remove bcache_subsys_id which got added stealthily
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cgroup.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 0e0b20b8c5db..789ec4683db3 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1845,36 +1845,43 @@ out: | |||
1845 | EXPORT_SYMBOL_GPL(cgroup_path); | 1845 | EXPORT_SYMBOL_GPL(cgroup_path); |
1846 | 1846 | ||
1847 | /** | 1847 | /** |
1848 | * task_cgroup_path_from_hierarchy - cgroup path of a task on a hierarchy | 1848 | * task_cgroup_path - cgroup path of a task in the first cgroup hierarchy |
1849 | * @task: target task | 1849 | * @task: target task |
1850 | * @hierarchy_id: the hierarchy to look up @task's cgroup from | ||
1851 | * @buf: the buffer to write the path into | 1850 | * @buf: the buffer to write the path into |
1852 | * @buflen: the length of the buffer | 1851 | * @buflen: the length of the buffer |
1853 | * | 1852 | * |
1854 | * Determine @task's cgroup on the hierarchy specified by @hierarchy_id and | 1853 | * Determine @task's cgroup on the first (the one with the lowest non-zero |
1855 | * copy its path into @buf. This function grabs cgroup_mutex and shouldn't | 1854 | * hierarchy_id) cgroup hierarchy and copy its path into @buf. This |
1856 | * be used inside locks used by cgroup controller callbacks. | 1855 | * function grabs cgroup_mutex and shouldn't be used inside locks used by |
1856 | * cgroup controller callbacks. | ||
1857 | * | ||
1858 | * Returns 0 on success, fails with -%ENAMETOOLONG if @buflen is too short. | ||
1857 | */ | 1859 | */ |
1858 | int task_cgroup_path_from_hierarchy(struct task_struct *task, int hierarchy_id, | 1860 | int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen) |
1859 | char *buf, size_t buflen) | ||
1860 | { | 1861 | { |
1861 | struct cgroupfs_root *root; | 1862 | struct cgroupfs_root *root; |
1862 | struct cgroup *cgrp = NULL; | 1863 | struct cgroup *cgrp; |
1863 | int ret = -ENOENT; | 1864 | int hierarchy_id = 1, ret = 0; |
1865 | |||
1866 | if (buflen < 2) | ||
1867 | return -ENAMETOOLONG; | ||
1864 | 1868 | ||
1865 | mutex_lock(&cgroup_mutex); | 1869 | mutex_lock(&cgroup_mutex); |
1866 | 1870 | ||
1867 | root = idr_find(&cgroup_hierarchy_idr, hierarchy_id); | 1871 | root = idr_get_next(&cgroup_hierarchy_idr, &hierarchy_id); |
1872 | |||
1868 | if (root) { | 1873 | if (root) { |
1869 | cgrp = task_cgroup_from_root(task, root); | 1874 | cgrp = task_cgroup_from_root(task, root); |
1870 | ret = cgroup_path(cgrp, buf, buflen); | 1875 | ret = cgroup_path(cgrp, buf, buflen); |
1876 | } else { | ||
1877 | /* if no hierarchy exists, everyone is in "/" */ | ||
1878 | memcpy(buf, "/", 2); | ||
1871 | } | 1879 | } |
1872 | 1880 | ||
1873 | mutex_unlock(&cgroup_mutex); | 1881 | mutex_unlock(&cgroup_mutex); |
1874 | |||
1875 | return ret; | 1882 | return ret; |
1876 | } | 1883 | } |
1877 | EXPORT_SYMBOL_GPL(task_cgroup_path_from_hierarchy); | 1884 | EXPORT_SYMBOL_GPL(task_cgroup_path); |
1878 | 1885 | ||
1879 | /* | 1886 | /* |
1880 | * Control Group taskset | 1887 | * Control Group taskset |