Sunday, 7 March 2010

Pin CPU core(s) to specific Xen domU (guest)

It is often needed for a virtual machine to use specific cores of those available. On a multi-core system, one or more cores can be assigned for each virtual machine to improve performance. By default a virtual machine will use any available core. Assuming that there is a machine with 4 cores and a virtual machine needs to use two of them, the following entries in the guest’s configuration file will present the virtual machine with two virtual CPUs and will map them between the 3rd and the 4th physical cores.

cpus = "2,3"
vcpus = 2

A longer range, let’s say on a 8core machine, can be specified as “2-8″ for example.
Which CPU is used for each VCPU can be seen with the xm vcpu-list command:

# xm vcpu-list node1
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node1                              4     0     2   -b-       1.9 2-3
node1                              4     1     3   -b-       2.8 2-3

If there’s no cpus definition in the config file, each VCPU will use any of the available physical ones. The following host is configured to have 4 VCPUS:

# xm vcpu-list node3
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node3                              2     0     3   -b-       2.1 any cpu
node3                              2     1     0   -b-       1.2 any cpu
node3                              2     2     2   -b-       0.9 any cpu
node3                              2     3     1   -b-       2.9 any cpu

However, I noticed that Xen will assign different CPU to each VCPU at different times, and many times the same CPU will be mapped to more than one VCPUs:

# xm vcpu-list node2
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node2                              8     0     2   -b-       4.1 0-2
node2                              8     1     1   -b-       1.6 0-2
node2                              8     2     1   -b-       1.5 0-2

2 comments:

Anonymous said...

Amiable dispatch and this mail helped me alot in my college assignement. Thank you as your information.

Anonymous said...

bms baufinanz 2006 idframer kronos shell pack cabinet creator linkman win9x recovery rune slot themefreak bumpnetworks pdfconv muster [url=http://bb-soft.co.cc/zero-popup-killer-xp-v4-6-free-download]Zero Popup Killer Xp V4.6 free download[/url] actinic ecommerce uk account express agmapthat logiscope copy text alarm clock pro ems-i gms recall pro flashhealth genie webcache32 [url=http://bb-soft.co.cc/zapper-plus-3-free-download]Zapper Plus 3 free download[/url] cd madness web code convert siteaid netvizion report miner linesmetry br’s photoarchiver find graph coolfocus hypermenu photo watermark