Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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.

share|improve this answer

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/

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.