[RFC PATCH 1/3] psi: make cgroup psi helpers public

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make cgroup psi helpers public for later cgroup v1 support.

Signed-off-by: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx>
---
 include/linux/cgroup.h | 21 +++++++++++++++++++++
 kernel/cgroup/cgroup.c | 33 ++++++++++++++++++---------------
 2 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index c0077adeea83..a5adb98490c9 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -682,6 +682,27 @@ static inline union kernfs_node_id *cgroup_get_kernfs_id(struct cgroup *cgrp)
 
 void cgroup_path_from_kernfs_id(const union kernfs_node_id *id,
 					char *buf, size_t buflen);
+
+#ifdef CONFIG_PSI
+int cgroup_io_pressure_show(struct seq_file *seq, void *v);
+int cgroup_memory_pressure_show(struct seq_file *seq, void *v);
+int cgroup_cpu_pressure_show(struct seq_file *seq, void *v);
+
+ssize_t cgroup_io_pressure_write(struct kernfs_open_file *of,
+				 char *buf, size_t nbytes,
+				 loff_t off);
+ssize_t cgroup_memory_pressure_write(struct kernfs_open_file *of,
+				     char *buf, size_t nbytes,
+				     loff_t off);
+ssize_t cgroup_cpu_pressure_write(struct kernfs_open_file *of,
+				  char *buf, size_t nbytes,
+				  loff_t off);
+
+__poll_t cgroup_pressure_poll(struct kernfs_open_file *of,
+			      struct poll_table_struct *pt);
+void cgroup_pressure_release(struct kernfs_open_file *of);
+#endif /* CONFIG_PSI */
+
 #else /* !CONFIG_CGROUPS */
 
 struct cgroup_subsys_state;
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 426a0026225c..cd3207454f8c 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -3550,21 +3550,23 @@ static int cpu_stat_show(struct seq_file *seq, void *v)
 }
 
 #ifdef CONFIG_PSI
-static int cgroup_io_pressure_show(struct seq_file *seq, void *v)
+int cgroup_io_pressure_show(struct seq_file *seq, void *v)
 {
 	struct cgroup *cgroup = seq_css(seq)->cgroup;
 	struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
 
 	return psi_show(seq, psi, PSI_IO);
 }
-static int cgroup_memory_pressure_show(struct seq_file *seq, void *v)
+
+int cgroup_memory_pressure_show(struct seq_file *seq, void *v)
 {
 	struct cgroup *cgroup = seq_css(seq)->cgroup;
 	struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
 
 	return psi_show(seq, psi, PSI_MEM);
 }
-static int cgroup_cpu_pressure_show(struct seq_file *seq, void *v)
+
+int cgroup_cpu_pressure_show(struct seq_file *seq, void *v)
 {
 	struct cgroup *cgroup = seq_css(seq)->cgroup;
 	struct psi_group *psi = cgroup->id == 1 ? &psi_system : &cgroup->psi;
@@ -3598,34 +3600,35 @@ static ssize_t cgroup_pressure_write(struct kernfs_open_file *of, char *buf,
 	return nbytes;
 }
 
-static ssize_t cgroup_io_pressure_write(struct kernfs_open_file *of,
-					  char *buf, size_t nbytes,
-					  loff_t off)
+ssize_t cgroup_io_pressure_write(struct kernfs_open_file *of,
+				 char *buf, size_t nbytes,
+				 loff_t off)
 {
 	return cgroup_pressure_write(of, buf, nbytes, PSI_IO);
 }
 
-static ssize_t cgroup_memory_pressure_write(struct kernfs_open_file *of,
-					  char *buf, size_t nbytes,
-					  loff_t off)
+ssize_t cgroup_memory_pressure_write(struct kernfs_open_file *of,
+				     char *buf, size_t nbytes,
+				     loff_t off)
 {
 	return cgroup_pressure_write(of, buf, nbytes, PSI_MEM);
 }
 
-static ssize_t cgroup_cpu_pressure_write(struct kernfs_open_file *of,
-					  char *buf, size_t nbytes,
-					  loff_t off)
+ssize_t cgroup_cpu_pressure_write(struct kernfs_open_file *of,
+				  char *buf, size_t nbytes,
+				  loff_t off)
 {
 	return cgroup_pressure_write(of, buf, nbytes, PSI_CPU);
 }
 
-static __poll_t cgroup_pressure_poll(struct kernfs_open_file *of,
-					  poll_table *pt)
+struct poll_table_struct;
+__poll_t cgroup_pressure_poll(struct kernfs_open_file *of,
+			      struct poll_table_struct *pt)
 {
 	return psi_trigger_poll(&of->priv, of->file, pt);
 }
 
-static void cgroup_pressure_release(struct kernfs_open_file *of)
+void cgroup_pressure_release(struct kernfs_open_file *of)
 {
 	psi_trigger_replace(&of->priv, NULL);
 }
-- 
2.19.1.856.g8858448bb




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux