[RFC,01/11] cgroup: Export cgroup_{procs,threads}_start and cgroup_procs_next

Message ID 20200624171749.11927-2-tom@herbertland.com
State New
Headers show
Series
  • [RFC,01/11] cgroup: Export cgroup_{procs,threads}_start and cgroup_procs_next
Related show

Commit Message

Tom Herbert June 24, 2020, 5:17 p.m.
Export the functions and put prototypes in linux/cgroup.h. This allows
creating cgroup entries that provide per task information.
---
 include/linux/cgroup.h | 3 +++
 kernel/cgroup/cgroup.c | 9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

Patch

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 4598e4da6b1b..59837f6f4e54 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -119,6 +119,9 @@  int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen);
 int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry);
 int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
 		     struct pid *pid, struct task_struct *tsk);
+void *cgroup_procs_start(struct seq_file *s, loff_t *pos);
+void *cgroup_threads_start(struct seq_file *s, loff_t *pos);
+void *cgroup_procs_next(struct seq_file *s, void *v, loff_t *pos);
 
 void cgroup_fork(struct task_struct *p);
 extern int cgroup_can_fork(struct task_struct *p,
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 1ea181a58465..69cd14201cf0 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4597,7 +4597,7 @@  static void cgroup_procs_release(struct kernfs_open_file *of)
 	}
 }
 
-static void *cgroup_procs_next(struct seq_file *s, void *v, loff_t *pos)
+void *cgroup_procs_next(struct seq_file *s, void *v, loff_t *pos)
 {
 	struct kernfs_open_file *of = s->private;
 	struct css_task_iter *it = of->priv;
@@ -4607,6 +4607,7 @@  static void *cgroup_procs_next(struct seq_file *s, void *v, loff_t *pos)
 
 	return css_task_iter_next(it);
 }
+EXPORT_SYMBOL_GPL(cgroup_procs_next);
 
 static void *__cgroup_procs_start(struct seq_file *s, loff_t *pos,
 				  unsigned int iter_flags)
@@ -4637,7 +4638,7 @@  static void *__cgroup_procs_start(struct seq_file *s, loff_t *pos,
 	return cgroup_procs_next(s, NULL, NULL);
 }
 
-static void *cgroup_procs_start(struct seq_file *s, loff_t *pos)
+void *cgroup_procs_start(struct seq_file *s, loff_t *pos)
 {
 	struct cgroup *cgrp = seq_css(s)->cgroup;
 
@@ -4653,6 +4654,7 @@  static void *cgroup_procs_start(struct seq_file *s, loff_t *pos)
 	return __cgroup_procs_start(s, pos, CSS_TASK_ITER_PROCS |
 					    CSS_TASK_ITER_THREADED);
 }
+EXPORT_SYMBOL_GPL(cgroup_procs_start);
 
 static int cgroup_procs_show(struct seq_file *s, void *v)
 {
@@ -4764,10 +4766,11 @@  static ssize_t cgroup_procs_write(struct kernfs_open_file *of,
 	return ret ?: nbytes;
 }
 
-static void *cgroup_threads_start(struct seq_file *s, loff_t *pos)
+void *cgroup_threads_start(struct seq_file *s, loff_t *pos)
 {
 	return __cgroup_procs_start(s, pos, 0);
 }
+EXPORT_SYMBOL_GPL(cgroup_threads_start);
 
 static ssize_t cgroup_threads_write(struct kernfs_open_file *of,
 				    char *buf, size_t nbytes, loff_t off)