[Devel] [PATCH RH8 v2] ve/fs: Export fs.aio-max-nr via ve cgroup
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Wed Apr 7 23:24:03 MSK 2021
From: Cyrill Gorcunov <gorcunov at virtuozzo.com>
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 commit 8512756dc855983bb54d633ef9c0d11d38da28c4)
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 031b104..93f9e75 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1508,6 +1508,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[] = {
{
@@ -1580,6 +1609,14 @@ static ssize_t ve_mount_opts_write(struct kernfs_open_file *of, char *buf,
.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
{ }
};
--
1.8.3.1
More information about the Devel
mailing list