[Devel] [PATCH RHEL8 COMMIT] ve/fs: Export fs.aio-max-nr via ve cgroup
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Apr 14 18:43:19 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.13
------>
commit 6bfb2d03b8a3ca7b23963008fd1527a6a812145f
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date: Wed Apr 14 18:43:19 2021 +0300
ve/fs: Export fs.aio-max-nr via ve cgroup
This member represents fs.aio-max-nr sysctl entries. I think being able
to c/r from libvzctl script is better in terms of keeping c/r work
in one place, so instead of handling fs.aio-max-nr with sysctl utility
from inside of ve context, I do it via scripts and for this sake
fs.aio-max-nr is exported via cgroup api.
https://jira.sw.ru/browse/PSBM-45646
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Acked-by: Kirill Tkhai <ktkhai at virtuozzo.com>
ktkhai@: We don't need to migrate fs.aio-nr. It's set when aio requests
are queued. If we migrate requests in the future, the true aio-nr will
be set automatically. Now we don't migrate requests (we are almost wait
them), so it's 0 on src and dst.
Rebased to vz8:
- Introduced new ve_aio_max_nr_read/write functions
instead of old helpers.
- Added #ifdef CONFIG_AIO since ve_struct->aio_max_nr
is also guarded by it.
(cherry picked from vz7 commit 8512756dc855 ("ve/fs: Export fs.aio-max-nr
via ve cgroup"))
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
kernel/ve/ve.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 7d0999e7e234..8dbf56e78bb9 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1450,6 +1450,35 @@ static ssize_t ve_mount_opts_write(struct kernfs_open_file *of, char *buf,
return nbytes;
}
+#ifdef CONFIG_AIO
+static u64 ve_aio_max_nr_read(struct cgroup_subsys_state *css,
+ struct cftype *cft)
+{
+ return css_to_ve(css)->aio_max_nr;
+}
+
+static int ve_aio_max_nr_write(struct cgroup_subsys_state *css,
+ struct cftype *cft, u64 val)
+{
+ struct ve_struct *ve = css_to_ve(css);
+
+ if (!ve_is_super(get_exec_env()) && !ve->is_pseudosuper)
+ return -EPERM;
+
+ down_write(&ve->op_sem);
+ if (ve->is_running || ve->ve_ns) {
+ up_write(&ve->op_sem);
+ return -EBUSY;
+ }
+
+ ve->aio_max_nr = val;
+
+ up_write(&ve->op_sem);
+
+ return 0;
+}
+#endif
+
static struct cftype ve_cftypes[] = {
{
@@ -1514,6 +1543,14 @@ static struct cftype ve_cftypes[] = {
.seq_show = ve_mount_opts_read,
.write = ve_mount_opts_write,
},
+#ifdef CONFIG_AIO
+ {
+ .name = "aio_max_nr",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_u64 = ve_aio_max_nr_read,
+ .write_u64 = ve_aio_max_nr_write,
+ },
+#endif
{ }
};
More information about the Devel
mailing list