[libvirt-users] cputune shares with multiple cpu and pinning

Edoardo Comar ECOMAR at uk.ibm.com
Tue Dec 3 22:09:24 UTC 2013


Hi, 

I have found the cpu time partitioning based on cpu shares weights not 
very intuitive.

On RHEL64, I deployed two qemu/kvm VMs 
VM1 with 1 vcpu   and  512 cpu shares 
VM2 with 2 vcpus and 1024 cpu shares 

I pinned their vcpus to specific host pcpus:
VM1 vcpu 0 to host pcpu1 
VM2 vcpu 0 to host pcpu1, VM2 vcpu 1 to host pcpu2

I executed inside the VMs a simple process that consume all available cpu, 
eg 
# cat /dev/zero > /dev/null

on the host, using 'top', the reported cpu usage per qemu process is :

with 1 process in VM1 and 1 process on vcpu1 in VM2
VM1 = 100%, VM2=100%
explanation - without contention for pcpu2 shares are to be irrelevant 
(that's ok!)
 
with 1 process in VM1 and 1 process on vcpu0 in VM2
VM1=33%, VM2=66% 
explanation - with contention on pcpu2, host cpu usage is partitioned 
according to shares (that's ok!)

with 1 process in VM1, and 2 processes in VM2 (one on vcpu0 and on vcpu1 - 
launched with taskset)
VM1=50%, VM2=150% 

This result was a bit unexpected to me: 
adding load on VM2 resulted in more cpu time allowed for VM1 - can anyone 
please explain the logic ?


Changing the pinning so that both VMs can use the host pcpuset 1-2
then the CPU usage is 
100%/100% when VM2 is executing one task only ( on whatever vcpu )
50%/150% when VM2 is executing two tasks.

again, not intuitive just by looking at the shares weights, I think.

--------------------------------------------------
Edoardo Comar
WebSphere Application Service Platform for Networks (ASPN)
ecomar at uk.ibm.com
+44 (0)1962 81 5576 
IBM UK Ltd, Hursley Park, SO21 2JN

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU




More information about the libvirt-users mailing list