1

I have a CentOS 6 host for several KVM VMs with FreeBSD as guest.

I want to bind each VM to use no more than one core at once. What would you suggest to use, Cgroups or Tasksets?

Mascarpone
  • 872
  • 3
  • 9
  • 28

3 Answers3

2

I think cgroups are the preferred method with EL6 now, especially with virtualization. Taskset is best for individual processes, but cgroups are closer to the notion of shielding/containers.

ewwhite
  • 197,159
  • 92
  • 443
  • 809
0

If you are using libvirt, you could use:

<domain>
  ...
  <vcpu placement='static' cpuset="1" current="1">2</vcpu>
  ...
</domain>

in the domain XML definition. Some interesting places with relevant info:

http://libvirt.org/formatdomain.html

http://wiki.libvirt.org/page/QEMUSwitchToLibvirt

http://berrange.com/posts/2010/02/12/controlling-guest-cpu-numa-affinity-in-libvirt-with-qemu-kvm-xen/

rubiojr
  • 234
  • 1
  • 3
0

For binding Vms to CPUs taskset is the right approach. cgroups are there for finer grained resource management, dealing in CPU usage shares. And of course @rubiojr already mentioned the libvirt native way of pinning vCPUs CPUs

dyasny
  • 18,802
  • 6
  • 49
  • 64