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?
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?
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.
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
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