summaryrefslogtreecommitdiffstats
path: root/kernel/cgroup.c
diff options
context:
space:
mode:
authorZefan Li <lizefan@huawei.com>2014-09-18 10:03:15 +0200
committerTejun Heo <tj@kernel.org>2014-09-18 19:27:23 +0200
commit006f4ac49742b5f70ef7e39176fd42a500144ccc (patch)
tree976006e7b7a5a0df635538fe51348e4648d9df8c /kernel/cgroup.c
parentcgroup: use a per-cgroup work for release agent (diff)
downloadlinux-006f4ac49742b5f70ef7e39176fd42a500144ccc.tar.xz
linux-006f4ac49742b5f70ef7e39176fd42a500144ccc.zip
cgroup: simplify proc_cgroup_show()
Use the ONE macro instead of REG, and we can simplify proc_cgroup_show(). Signed-off-by: Zefan Li <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r--kernel/cgroup.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index db19a4884a7f..df7733b48d2e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5030,12 +5030,9 @@ core_initcall(cgroup_wq_init);
* - Print task's cgroup paths into seq_file, one line for each hierarchy
* - Used for /proc/<pid>/cgroup.
*/
-
-/* TODO: Use a proper seq_file iterator */
-int proc_cgroup_show(struct seq_file *m, void *v)
+int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
+ struct pid *pid, struct task_struct *tsk)
{
- struct pid *pid;
- struct task_struct *tsk;
char *buf, *path;
int retval;
struct cgroup_root *root;
@@ -5045,14 +5042,6 @@ int proc_cgroup_show(struct seq_file *m, void *v)
if (!buf)
goto out;
- retval = -ESRCH;
- pid = m->private;
- tsk = get_pid_task(pid, PIDTYPE_PID);
- if (!tsk)
- goto out_free;
-
- retval = 0;
-
mutex_lock(&cgroup_mutex);
down_read(&css_set_rwsem);
@@ -5082,11 +5071,10 @@ int proc_cgroup_show(struct seq_file *m, void *v)
seq_putc(m, '\n');
}
+ retval = 0;
out_unlock:
up_read(&css_set_rwsem);
mutex_unlock(&cgroup_mutex);
- put_task_struct(tsk);
-out_free:
kfree(buf);
out:
return retval;