[libvirt] [PATCH] Temporarily shutoff CPUSET cgroup in libvirt.

Tang Chen tangchen at cn.fujitsu.com
Thu Sep 27 10:16:39 UTC 2012


Hi Eric~

I found that even if I remove cpuset in qemu.conf, the corresponding
cgroup directories will still be created. Such as:

/cgroup
   |->cpuset
        |->libvirt
             |->qemu
             |    |->vm1
             |->lxc

Is this behaviour correct ?

IMHO, if we shutoff cpuset cgroup in qemu.conf, the qemu and vm1
directories should not be created.

Am I right ?

Thanks. :)

On 09/21/2012 04:20 PM, Tang Chen wrote:
> When a cpu or memory is offlined and onlined again, cgroup will not
> recover any corresponding values. This is a problem in kernel.
> Do not use CPUSET cgroup to limit threads using cpu and memory until
> the problem is fixed in kernel.
>
> Signed-off-by: Tang Chen<tangchen at cn.fujitsu.com>
> ---
>   src/qemu/qemu.conf   |    5 ++++-
>   src/qemu/qemu_conf.c |    7 ++++++-
>   src/util/cgroup.c    |    3 +--
>   3 files changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
> index 18105ca..6bf7290 100644
> --- a/src/qemu/qemu.conf
> +++ b/src/qemu/qemu.conf
> @@ -211,7 +211,10 @@
>   # can be mounted in different locations. libvirt will detect
>   # where they are located.
>   #
> -#cgroup_controllers = [ "cpu", "devices", "memory", "blkio", "cpuset", "cpuacct" ]
> +# When a cpu or memory is offlined and onlined again, cgroup will not
> +# recover any corresponding values. This is a problem in kernel.
> +# So DO NOT use cpuset cgroup until this problem is fixed in kernel.
> +#cgroup_controllers = [ "cpu", "devices", "memory", "blkio", "cpuacct" ]
>
>   # This is the basic set of devices allowed / required by
>   # all virtual machines.
> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index 91a56f1..80b0787 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -397,12 +397,17 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
>               driver->cgroupControllers |= (1<<  ctl);
>           }
>       } else {
> +        /*
> +         * When a cpu or memory is offlined and onlined again, cgroup will not
> +         * recover any corresponding values. This is a problem in kernel.
> +         * Do not use CPUSET cgroup to limit threads using cpu and memory until
> +         * the problem is fixed in kernel.
> +         */
>           driver->cgroupControllers =
>               (1<<  VIR_CGROUP_CONTROLLER_CPU) |
>               (1<<  VIR_CGROUP_CONTROLLER_DEVICES) |
>               (1<<  VIR_CGROUP_CONTROLLER_MEMORY) |
>               (1<<  VIR_CGROUP_CONTROLLER_BLKIO) |
> -            (1<<  VIR_CGROUP_CONTROLLER_CPUSET) |
>               (1<<  VIR_CGROUP_CONTROLLER_CPUACCT);
>       }
>       for (i = 0 ; i<  VIR_CGROUP_CONTROLLER_LAST ; i++) {
> diff --git a/src/util/cgroup.c b/src/util/cgroup.c
> index 5dc0764..cd7d3fe 100644
> --- a/src/util/cgroup.c
> +++ b/src/util/cgroup.c
> @@ -543,8 +543,7 @@ static int virCgroupMakeGroup(virCgroupPtr parent, virCgroupPtr group,
>           /* We need to control cpu bandwidth for each vcpu now */
>           if ((flags&  VIR_CGROUP_VCPU)&&
>               (i != VIR_CGROUP_CONTROLLER_CPU&&
> -             i != VIR_CGROUP_CONTROLLER_CPUACCT&&
> -             i != VIR_CGROUP_CONTROLLER_CPUSET)) {
> +             i != VIR_CGROUP_CONTROLLER_CPUACCT)) {
>               /* treat it as unmounted and we can use virCgroupAddTask */
>               VIR_FREE(group->controllers[i].mountPoint);
>               continue;




More information about the libvir-list mailing list