[libvirt] [PATCH 0/9] fix thread related controllers in cgroups

Henning Schild henning.schild at siemens.com
Tue Feb 23 15:58:33 UTC 2016

This series picks up the cgroups work i started earlier. My initial
patches got in and later reverted before 1.3.1.

The problem the series is solving is about qemu-threads becoming
runnable on pcpus outside the pinning masks configured for the
machine. That only happens for a short time before the thread is
moved to its final cpuset. But it can disturb other load on the
system or can lead to qemu never starting. (qemu main thread
ends up on a pcpu with busy high prio rt-task).

The problem in the original series was the lack of understanding 
that one virCgroup can cover all controllers. Instead of just touching
cpusets the patches had side effects on all the other controllers
(memory, blkio etc.) Again the general idea is to put all threads
right into the correct cgroups and to not move them around. But this
series touches only the cpu, cpuset, and cpuacct controllers. That are
the ones relevant to threads and that are the controllers the
threading sub-groups have mounted.

Patches 1, 2, and 9 deal with asserting correct behaviour. They are
optional. But given the complexity of the "bringup" and the importance
of getting that right, i think they should go in as well!

The tricky bits are in patches 5 and 8, i kept them as simple as

The series is based on v1.3.1.

Henning Schild (9):
  vircgroup: one central point for adding tasks to cgroups
  vircgroup: add assertion to allow cgroup controllers to stay empty
  vircgroup: introduce controller mask for threads
  util: cgroups do not implicitly add task to new machine cgroup
  qemu_cgroup: put qemu right into emulator sub-cgroup
  qemu_cgroup: use virCgroupAddTask instead of virCgroupMoveTask
  vircgroup: add controller mask to virCgroupAddTask
  qemu_cgroup: dont put qemu main thread into wrong cgroup
  qemu_cgroup: assert threading cgroup layout for machine cgroup

 src/libvirt_private.syms |   3 +-
 src/lxc/lxc_cgroup.c     |  11 ++++
 src/lxc/lxc_controller.c |   4 +-
 src/qemu/qemu_cgroup.c   |  30 +++++++--
 src/qemu/qemu_driver.c   |   2 +-
 src/qemu/qemu_process.c  |   8 +--
 src/util/vircgroup.c     | 155 ++++++++---------------------------------------
 src/util/vircgroup.h     |  13 +++-
 src/util/vircgrouppriv.h |   1 +
 9 files changed, 81 insertions(+), 146 deletions(-)


More information about the libvir-list mailing list