[Devel] [PATCH RHEL7 COMMIT] ve/fs: Export fs.aio-max-nr via ve cgroup

Konstantin Khorenko khorenko at virtuozzo.com
Tue Apr 12 03:18:05 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.7
------>
commit 4243f1260567d3ebd70c2243f45604f9e414b31d
Author: Cyrill Gorcunov <gorcunov at virtuozzo.com>
Date:   Tue Apr 12 14:18:05 2016 +0400

    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.
---
 kernel/ve/ve.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 1811849..53fa12d 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1180,7 +1180,8 @@ enum {
 	VE_CF_IPTABLES_MASK,
 	VE_CF_PSEUDOSUPER,
 	VE_CF_CLOCK_MONOTONIC,
-	VE_CF_CLOCK_BOOTBASED
+	VE_CF_CLOCK_BOOTBASED,
+	VE_CF_AIO_MAX_NR,
 };
 
 static int ve_ts_read(struct cgroup *cg, struct cftype *cft, struct seq_file *m)
@@ -1240,6 +1241,8 @@ static u64 ve_read_u64(struct cgroup *cg, struct cftype *cft)
 #endif
 	else if (cft->private == VE_CF_PSEUDOSUPER)
 		return cgroup_ve(cg)->is_pseudosuper;
+	else if (cft->private == VE_CF_AIO_MAX_NR)
+		return cgroup_ve(cg)->aio_max_nr;
 	return 0;
 }
 
@@ -1276,7 +1279,8 @@ static int ve_write_u64(struct cgroup *cg, struct cftype *cft, u64 value)
 {
 	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 +1295,8 @@ static int ve_write_u64(struct cgroup *cg, struct cftype *cft, u64 value)
 	else if (cft->private == VE_CF_IPTABLES_MASK)
 		ve->ipt_mask = ve_setup_iptables_mask(value);
 #endif
+	else if (cft->private == VE_CF_AIO_MAX_NR)
+		ve->aio_max_nr = value;
 	up_write(&ve->op_sem);
 	return 0;
 }
@@ -1359,6 +1365,13 @@ static struct cftype ve_cftypes[] = {
 		.write_string		= ve_ts_write,
 		.private		= VE_CF_CLOCK_BOOTBASED,
 	},
+	{
+		.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