Re: [PATCH 05/18] Don't create dirs in cgroup controllers we don't want to use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/04/2013 07:40 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Currently when getting an instance of virCgroupPtr we will
> create the path in all cgroup controllers. Only at the virt
> driver layer are we attempting to filter controllers. This
> is bad because the mere act of creating the dirs in the
> controllers can have a functional impact on the kernel,
> particularly for performance.
> 
> Update the virCgroupForDriver() method to accept a bitmask
> of controllers to use. Only create dirs in the controllers
> that are requested. When creating cgroups for domains,
> respect the active controller list from the parent cgroup
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---

> +++ b/src/lxc/lxc_cgroup.c
> @@ -530,7 +530,7 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr def)
>      int ret = -1;
>      int rc;
>  
> -    rc = virCgroupForDriver("lxc", &driver, 1, 0);
> +    rc = virCgroupForDriver("lxc", &driver, 1, 0, -1);

Do we want -1 to always mean all possible groups, or should we define a
symbolic constant which contains the mask of the maximum groups and
leave remaining bits 0?  Then again, this is never passed over the wire,
so it is not an RPC compatibility concern, so I guess it doesn't matter.

> +++ b/src/qemu/qemu_conf.c
> @@ -134,14 +134,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
>      }
>      cfg->dynamicOwnership = privileged;
>  
> -    cfg->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);
> -
> +    cfg->cgroupControllers = -1; /* -1 == auto-detect */

Oh, -1 isn't _all_ controllers, but auto-detect.  Now it makes more sense.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]