Bug 850718 - RFE: Reduce the depth of libvirt cgroup hierarchy
RFE: Reduce the depth of libvirt cgroup hierarchy
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Daniel Berrange
Virtualization Bugs
: FutureFeature
Depends On:
Blocks: 797489
  Show dependency treegraph
 
Reported: 2012-08-22 04:42 EDT by Daniel Berrange
Modified: 2014-06-17 20:41 EDT (History)
8 users (show)

See Also:
Fixed In Version: libvirt-1.0.5
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 07:58:27 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2012-08-22 04:42:42 EDT
Description of problem:
The depth of the cgroup heirarchy can have performance implications. Libvirt currently creates a hierarchy 3 to 4 levels deep below the cgroup that libvirtd itself is placed in.

  libvirt/$DRIVERNAME/$VMNAME/$VCPUNUM

The first level is potentially redundant if systemd is already placing libvirtd in a private cgroup. The second and third levels could be optionally combined into '$DRIVERNAME-$VMNAME' 

There could be back compatibility issues with changing this, and potentially different scenarios will need different arrangements. Thus the layout probably ought to be made configuration, using placeholders eg

 1. Match current hardcoded layout:

    cgroup_layout="::PROCESS::/libvirt/::DRIVER::/::VMNAME::" 

 2. Remove first level when used with systemd:

    cgroup_layout="::PROCESS::/::DRIVER::/::VMNAME::" 

 3. Ignore current libvirtd placement completely and create in the root:

    cgroup_layout="/libvirt/::DRIVER::/::VMNAME::"

 4. Combine 2nd and 3rd levels

    cgroup_layout="/libvirt/::DRIVER::-::VMNAME::"

 5. Combine 2nd and 3rd levels, but use UUID instead of VM name

    cgroup_layout="/libvirt/::DRIVER::-::VMUUID::"

etc
Comment 1 Daniel Berrange 2013-07-02 10:25:01 EDT
Resolved with the introduction of the new cgroups layout in libvirt

http://libvirt.org/cgroups.html
Comment 2 yanbing du 2013-11-11 04:16:02 EST
# rpm -q libvirt
libvirt-1.1.1-11.el7.x86_64

Start 2 guests(named: virt-tests-vm and test), then check the cgroup layout:

# lscgroup 
cpuset:/
cpuset:/machine.slice
cpuset:/machine.slice/machine-qemu\x2dtest.scope
cpuset:/machine.slice/machine-qemu\x2dtest.scope/emulator
cpuset:/machine.slice/machine-qemu\x2dtest.scope/vcpu0
cpuset:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
cpuset:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope/emulator
cpuset:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope/vcpu0
cpu,cpuacct:/
cpu,cpuacct:/machine.slice
cpu,cpuacct:/machine.slice/machine-qemu\x2dtest.scope
cpu,cpuacct:/machine.slice/machine-qemu\x2dtest.scope/emulator
cpu,cpuacct:/machine.slice/machine-qemu\x2dtest.scope/vcpu0
cpu,cpuacct:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
cpu,cpuacct:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope/emulator
cpu,cpuacct:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope/vcpu0
memory:/
memory:/machine.slice
memory:/machine.slice/machine-qemu\x2dtest.scope
memory:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
devices:/
devices:/machine.slice
devices:/machine.slice/machine-qemu\x2dtest.scope
devices:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
freezer:/
freezer:/machine.slice
freezer:/machine.slice/machine-qemu\x2dtest.scope
freezer:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
net_cls:/
net_cls:/machine.slice
net_cls:/machine.slice/machine-qemu\x2dtest.scope
net_cls:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
blkio:/
blkio:/machine.slice
blkio:/machine.slice/machine-qemu\x2dtest.scope
blkio:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
perf_event:/
perf_event:/machine.slice
perf_event:/machine.slice/machine-qemu\x2dtest.scope
perf_event:/machine.slice/machine-qemu\x2dvirt\x2dtests\x2dvm.scope
hugetlb:/


# ll /sys/fs/cgroup/systemd/
total 0
-rw-r--r--.  1 root root 0 Nov  6 14:59 cgroup.clone_children
--w--w--w-.  1 root root 0 Nov  6 14:59 cgroup.event_control
-rw-r--r--.  1 root root 0 Nov  6 14:59 cgroup.procs
-r--r--r--.  1 root root 0 Nov  6 14:59 cgroup.sane_behavior
drwxr-xr-x.  4 root root 0 Nov 11 16:23 machine.slice
-rw-r--r--.  1 root root 0 Nov  6 14:59 notify_on_release
-rw-r--r--.  1 root root 0 Nov  6 14:59 release_agent
drwxr-xr-x. 78 root root 0 Nov 11 16:50 system.slice
-rw-r--r--.  1 root root 0 Nov  6 14:59 tasks
drwxr-xr-x.  3 root root 0 Nov  6 14:59 user.slice

# ll /sys/fs/cgroup/systemd/machine.slice/
total 0
-rw-r--r--. 1 root root 0 Nov  6 15:10 cgroup.clone_children
--w--w--w-. 1 root root 0 Nov  6 15:10 cgroup.event_control
-rw-r--r--. 1 root root 0 Nov  6 15:10 cgroup.procs
drwxr-xr-x. 2 root root 0 Nov 11 17:12 machine-qemu\x2dtest.scope
drwxr-xr-x. 2 root root 0 Nov 11 16:24 machine-qemu\x2dvirt\x2dtests\x2dvm.scope
-rw-r--r--. 1 root root 0 Nov  6 15:10 notify_on_release
-rw-r--r--. 1 root root 0 Nov  6 15:10 tasks
Comment 3 Ludek Smid 2014-06-13 07:58:27 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

Note You need to log in before you can comment on or make changes to this bug.