[Devel] [PATCH RHEL7 COMMIT] ve: Add support of features mask
Konstantin Khorenko
khorenko at odin.com
Tue May 19 01:00:30 PDT 2015
The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.3
------>
commit e4a000bb307164268889b842e0a50dcba2e47376
Author: Cyrill Gorcunov <gorcunov at odin.com>
Date: Tue May 19 12:00:24 2015 +0400
ve: Add support of features mask
While working on running Docker on rhel7 kernel I found that we
don't have any interface to setup VE's features.
So here is a trivial one: new entry in ve/$ID cgroup as @ve.feature.
https://jira.sw.ru/browse/PSBM-32737
Signed-off-by: Cyrill Gorcunov <gorcunov at odin.com>
CC: Vladimir Davydov <vdavydov at odin.com>
CC: Konstantin Khorenko <khorenko at odin.com>
CC: Pavel Emelyanov <xemul at odin.com>
CC: Andrey Vagin <avagin at odin.com>
---
kernel/ve/ve.c | 48 +++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index cf7c848..42b1021 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -44,6 +44,7 @@
#include <uapi/linux/vzcalluser.h>
#include <linux/venet.h>
+#include <linux/vziptable_defs.h>
static struct kmem_cache *ve_cachep;
@@ -1089,17 +1090,50 @@ up_opsem:
return ret;
}
+enum {
+ VE_CF_STATE,
+ VE_CF_LEGACY_VEID,
+ VE_CF_FEATURES,
+};
+
+static u64 ve_read_u64(struct cgroup *cg, struct cftype *cft)
+{
+ if (cft->private == VE_CF_FEATURES)
+ return cgroup_ve(cg)->features;
+ return 0;
+}
+
+static int ve_write_u64(struct cgroup *cg, struct cftype *cft, u64 value)
+{
+ if (!ve_is_super(get_exec_env()))
+ return -EPERM;
+
+ if (cft->private == VE_CF_FEATURES)
+ cgroup_ve(cg)->features = value;
+
+ return 0;
+}
+
static struct cftype ve_cftypes[] = {
{
- .name = "state",
- .flags = CFTYPE_NOT_ON_ROOT,
- .read_seq_string = ve_state_read,
- .write_string = ve_state_write,
+ .name = "state",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_seq_string = ve_state_read,
+ .write_string = ve_state_write,
+ .private = VE_CF_STATE,
},
{
- .name = "legacy_veid",
- .flags = CFTYPE_NOT_ON_ROOT,
- .read_seq_string = ve_legacy_veid_read,
+ .name = "legacy_veid",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_seq_string = ve_legacy_veid_read,
+ .private = VE_CF_LEGACY_VEID,
+ },
+ {
+ .name = "features",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .read_u64 = ve_read_u64,
+ .write_u64 = ve_write_u64,
+ .private = VE_CF_FEATURES,
},
{
.name = "mount_opts",
More information about the Devel
mailing list