[libvirt] [PATCH v1 1/6] cgroup: Add a flag VIR_CGROUP_DISABLE_CPUSET

Hu Tao hutao at cn.fujitsu.com
Wed Nov 7 10:38:41 UTC 2012


Add a flag VIR_CGROUP_DISABLE_CPUSET to disable cgroup cpuset.
This flag inhibits making of directory under cpuset.
---
 src/util/cgroup.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 3f7b5f7..2f64f5d 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -72,6 +72,7 @@ typedef enum {
                                        */
     VIR_CGROUP_VCPU = 1 << 1, /* create subdir only under the cgroup cpu,
                                * cpuacct and cpuset if possible. */
+    VIR_CGROUP_DISABLE_CPUSET = 1 << 2,
 } virCgroupFlags;
 
 /**
@@ -540,6 +541,12 @@ static int virCgroupMakeGroup(virCgroupPtr parent, virCgroupPtr group,
         if (!group->controllers[i].mountPoint)
             continue;
 
+        if ((flags & VIR_CGROUP_DISABLE_CPUSET) &&
+            i == VIR_CGROUP_CONTROLLER_CPUSET) {
+            group->controllers[i].mountPoint = NULL;
+            continue;
+        }
+
         /* We need to control cpu bandwidth for each vcpu now */
         if ((flags & VIR_CGROUP_VCPU) &&
             (i != VIR_CGROUP_CONTROLLER_CPU &&
-- 
1.7.11.7




More information about the libvir-list mailing list