[libvirt-users] cgroups limitations on Virtual machines

Zvi Dubitzky DUBI at il.ibm.com
Mon Mar 14 16:39:51 UTC 2011


I have 2 VMs  launched by : 'virsh create <xml file>' .  Both VMs get 2 
vcpus (out of total 2 cores of  the host) 
I then try bias their cpu cycle quota by manipulating the cpu_shares ( 
virsh schedinfo --set cpu_shares=<value> vm1/2 ) so that   VM1 will get 3 
times the cpu cycles VM2 gets.
(e.g : VM1 cpu_shares = 150 . VM2 cpu_shares = 50) .
There are no other VMs defined or any other significant process running on 
the host .
Each VM runs the same process (2 threads endless loop ).
Still both VM1 and VM2 get equal share of the 2 cores - running top 
utility
at the host shows each is consuming 100% CPU.
At each VM console cat /proc/cpuinfo shows 2 cores assigned to the VM.
At the host : virsh vcpuinfo <vm1/2> shows each has 2 vcpus (0 an 1 )but 
actually a single separate CPU is used for either vcpu0 or vcpu1 at each 
VM at any check point in time  (this is reasonable as it does not say what 
portion of the core cycles is used by each VM) .

Can anyone explain that and how to  bias the core usage of the 2 VMs by 
manipulating the cpu_shares parameter (or other parameters) so that 'top' 
at the host will reflect the bias . I would expect  'top' at the host  to 
show 150% CPU for VM1 ( qemu-system-x86) and 50% CPU for  VM2 (the other  
qemu-system-x86)  with above set cpu_share values .

Doing the same test with 2 plain processes (instead VMs udner libvirt) 
with same cpu_shares bias gives the expected biased cpu usage between the 
2 processes

My system is fedora14 and kernel 2.6.35.6-45.fc14.x86_64 .

thanks

Zvi Dubitzky 
Email:dubi at il.ibm.com





More information about the libvirt-users mailing list