Installation guide

</cpus>
</cell>
</cells>
</topology>
2. Observe that the node 1, <cell id='1'>, has physical CPUs 4 to 7.
3. The guest can be locked to a set of CPUs by appending the cpuset attribute to the
configuration file.
a. While the guest is offline, open the configuration file with virsh edit.
b. Locate where the guest's virtual CPU count is specified. Find the vcpus element.
<vcpus>4</vcpus>
The guest in this example has four CPUs.
c. Add a cpuset attribute with the CPU numbers for the relevant NUMA cell.
<vcpus cpuset='4-7'>4</vcpus>
4. Save the configuration file and restart the guest.
The guest has been locked to CPUs 4 to 7.
Au t o mat ically lo ckin g g u est s to CPU s wit h virt - in st all
The virt-install provisioning tool provides a simple way to automatically apply a 'best fit' NUMA
policy when guests are created.
The cpuset option for virt-install can use a CPU set of processors or the parameter auto. The
auto parameter automatically determines the optimal CPU locking using the available NUMA data.
For a NUMA system, use the --cpuset=auto with the virt-install command when creating new
guests.
T u n in g CPU af f in it y on ru n n in g g u est s
There may be times where modifying CPU affinities on running guests is preferable to rebooting the
guest. The virsh vcpuinfo and virsh vcpupin commands can perform CPU affinity changes
on running guests.
The virsh vcpuinfo command gives up to date information about where each virtual CPU is
running.
In this example, guest1 is a guest with four virtual CPUs is running on a KVM host.
# virsh vcpuinfo guest1
VCPU: 0
CPU: 3
State: running
CPU time: 0.5s
CPU Affinity: yyyyyyyy
VCPU: 1
CPU: 1
State: running
CPU Affinity: yyyyyyyy
VCPU: 2
Red Hat En t erp rise Lin ux 5 Virt ualizat ion Guid e
320