[Devel] [PATCH rh7] ve: fs -- Export fs.aio-nr and fs.aio-max-nr via ve cgroup
Cyrill Gorcunov
gorcunov at virtuozzo.com
Sat Apr 9 02:49:37 PDT 2016
This members represents fs.aio-(max)-nr sysctl entries.
While fs.aio-max-nr can be adjusted from inside of ve with
traditional sysctl utility the @aio-nr is read only so we
need an interface for its c/r.
Moreover 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-40690
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
CC: Vladimir Davydov <vdavydov at virtuozzo.com>
CC: Konstantin Khorenko <khorenko at virtuozzo.com>
---
kernel/ve/ve.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
Index: linux-pcs7.git/kernel/ve/ve.c
===================================================================
--- linux-pcs7.git.orig/kernel/ve/ve.c
+++ linux-pcs7.git/kernel/ve/ve.c
@@ -1180,7 +1180,9 @@ enum {
VE_CF_IPTABLES_MASK,
VE_CF_PSEUDOSUPER,
VE_CF_CLOCK_MONOTONIC,
- VE_CF_CLOCK_BOOTBASED
+ VE_CF_CLOCK_BOOTBASED,
+ VE_CF_AIO_NR,
+ VE_CF_AIO_MAX_NR,
};
static int ve_ts_read(struct cgroup *cg, struct cftype *cft, struct seq_file *m)
@@ -1240,6 +1242,10 @@ static u64 ve_read_u64(struct cgroup *cg
#endif
else if (cft->private == VE_CF_PSEUDOSUPER)
return cgroup_ve(cg)->is_pseudosuper;
+ else if (cft->private == VE_CF_AIO_NR)
+ return cgroup_ve(cg)->aio_nr;
+ else if (cft->private == VE_CF_AIO_MAX_NR)
+ return cgroup_ve(cg)->aio_max_nr;
return 0;
}
@@ -1276,7 +1282,8 @@ static int ve_write_u64(struct cgroup *c
{
struct ve_struct *ve = cgroup_ve(cg);
- if (!ve_is_super(get_exec_env()))
+ if (!ve_is_super(get_exec_env()) &&
+ !ve->is_pseudosuper)
return -EPERM;
down_write(&ve->op_sem);
@@ -1291,6 +1298,10 @@ static int ve_write_u64(struct cgroup *c
else if (cft->private == VE_CF_IPTABLES_MASK)
ve->ipt_mask = ve_setup_iptables_mask(value);
#endif
+ else if (cft->private == VE_CF_AIO_NR)
+ ve->aio_nr = value;
+ else if (cft->private == VE_CF_AIO_MAX_NR)
+ ve->aio_max_nr = value;
up_write(&ve->op_sem);
return 0;
}
@@ -1359,6 +1370,20 @@ static struct cftype ve_cftypes[] = {
.write_string = ve_ts_write,
.private = VE_CF_CLOCK_BOOTBASED,
},
+ {
+ .name = "aio_nr",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_u64 = ve_read_u64,
+ .write_u64 = ve_write_u64,
+ .private = VE_CF_AIO_NR,
+ },
+ {
+ .name = "aio_max_nr",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_u64 = ve_read_u64,
+ .write_u64 = ve_write_u64,
+ .private = VE_CF_AIO_MAX_NR,
+ },
{ }
};
More information about the Devel
mailing list