[Fedora-xen] CPU management

Richard W.M. Jones rjones at redhat.com
Fri Jan 18 11:46:41 UTC 2008


> I would like to be able to give, for example, 33% for dom1 and dom2
> and 33% for dom0, but  I know that we can only work with VCPUs.

It doesn't work like this.  Guests don't normally consume CPU 
continuously (well, unless you're running something like numerical 
simulations, which I really wouldn't recommend for virtualization).

First of all, if you do nothing at all then guests' virtual CPUs are 
scheduled to run on physical CPUs at random.  When a guest starts to do 
something, a physical CPU is picked and the guest runs on that for some 
short timeslice.  You can easily have more virtual CPUs than physical 
CPUs.  If your guests are mostly idle, the this is fine.

Now you can also pin a virtual CPU to a subset of physical CPUs (or to 
just a single physical CPU).  Using virsh/libvirt:

   virsh vcpupin guest 0 1

would pin guest's virtual CPU #0 to physical CPU #1.  So now when 
guest's virtual CPU #0 wakes up to do some work, it will only be 
scheduled to run on physical CPU #1, if necessary waiting until physical 
CPU #1 becomes free.

If you had a quad-core machine (4 physical CPUs) and 1 dom0 + 3 guests, 
and each dom0/guest has a single virtual CPU, then you might consider 
pinning the dom0 and each guest to a separate physical CPU.  Whether 
this is a good idea or not depends on what each guest will be doing and 
requires careful analysis and performance monitoring.

Use the command:

   virt-top -1

to show which guests are running on which physical CPUs in real time.

Rich.

-- 
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/xen/attachments/20080118/9690463b/attachment.bin 


More information about the xen mailing list