From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: linux-mm@kvack.org, cgroups@vger.kernel.org
Cc: Johannes Weiner <hannes@cmpxchg.org>,
akpm@linux-foundation.org, Tejun Heo <tj@kernel.org>,
Jiufei Xue <jiufei.xue@linux.alibaba.com>,
Caspar Zhang <caspar@linux.alibaba.com>,
Joseph Qi <joseph.qi@linux.alibaba.com>
Subject: [RFC PATCH 1/3] psi: make cgroup psi helpers public
Date: Tue, 4 Jun 2019 09:57:43 +0800 [thread overview]
Message-ID: <20190604015745.78972-2-joseph.qi@linux.alibaba.com> (raw)
In-Reply-To: <20190604015745.78972-1-joseph.qi@linux.alibaba.com>
Make cgroup psi helpers public for later cgroup v1 support.
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
---
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
next prev parent reply other threads:[~2019-06-04 1:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-04 1:57 [RFC PATCH 0/3] psi: support cgroup v1 Joseph Qi
2019-06-04 1:57 ` Joseph Qi [this message]
2019-06-04 1:57 ` [RFC PATCH 2/3] psi: cgroup v1 support Joseph Qi
2019-06-04 11:55 ` Johannes Weiner
2019-06-05 1:15 ` Joseph Qi
2019-06-04 1:57 ` [RFC PATCH 3/3] psi: add cgroup v1 interfaces Joseph Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190604015745.78972-2-joseph.qi@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=caspar@linux.alibaba.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jiufei.xue@linux.alibaba.com \
--cc=linux-mm@kvack.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox