Configuring the XML
When configuring NUMA awareness feature, you can specify the location of virtual NUMA node (vNode) memory on the host to implement memory block binding and vCPU binding so that the vCPU and memory on the vNode are on the same physical NUMA node. The following provides the VM XML configuration for reference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <vcpu placement='static'>16</vcpu> <cputune> <vcpupin vcpu='0' cpuset='24'/> <vcpupin vcpu='1' cpuset='25'/> <vcpupin vcpu='2' cpuset='26'/> <vcpupin vcpu='3' cpuset='27'/> <vcpupin vcpu='4' cpuset='28'/> <vcpupin vcpu='5' cpuset='29'/> <vcpupin vcpu='6' cpuset='30'/> <vcpupin vcpu='7' cpuset='31'/> <vcpupin vcpu='8' cpuset='32'/> <vcpupin vcpu='9' cpuset='33'/> <vcpupin vcpu='10' cpuset='34'/> <vcpupin vcpu='11' cpuset='35'/> <vcpupin vcpu='12' cpuset='36'/> <vcpupin vcpu='13' cpuset='37'/> <vcpupin vcpu='14' cpuset='38'/> <vcpupin vcpu='15' cpuset='39'/> <emulatorpin cpuset='24-39'/> </cputune> <numatune> <memnode cellid='0' mode='strict' nodeset='0'/> <memnode cellid='1' mode='strict' nodeset='1'/> </numatune> <cpu mode='host-passthrough' check='none'> <topology sockets='1' dies='1' clusters='4' cores='4' threads='1'/> <numa> <cell id='0' cpus='0-7' memory='4194304' unit='KiB'/> <cell id='1' cpus='8-15' memory='4194304' unit='KiB'/> </numa> </cpu> |
Configuration steps
- Map one vCPU to each physical host CPU, that is, 1:1 core binding.In the following configuration, the VM memory is set to 8 GB, the number of vCPUs is set to 16, and vCPUs 0 to 15 are bound to the host CPUs 24 to 39, respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<memory unit='KiB'>8388608</memory> <currentMemory unit='KiB'>8388608</currentMemory> <vcpu placement='static'>16</vcpu> <cputune> <vcpupin vcpu='0' cpuset='24'/> <vcpupin vcpu='1' cpuset='25'/> <vcpupin vcpu='2' cpuset='26'/> <vcpupin vcpu='3' cpuset='27'/> <vcpupin vcpu='4' cpuset='28'/> <vcpupin vcpu='5' cpuset='29'/> <vcpupin vcpu='6' cpuset='30'/> <vcpupin vcpu='7' cpuset='31'/> <vcpupin vcpu='8' cpuset='32'/> <vcpupin vcpu='9' cpuset='33'/> <vcpupin vcpu='10' cpuset='34'/> <vcpupin vcpu='11' cpuset='35'/> <vcpupin vcpu='12' cpuset='36'/> <vcpupin vcpu='13' cpuset='37'/> <vcpupin vcpu='14' cpuset='38'/> <vcpupin vcpu='15' cpuset='39'/> <emulatorpin cpuset='24-39'/> </cputune>
- Configure the VM NUMA.Configure two NUMA nodes for the VM: node 0 and node 1.
1 2 3 4
<numatune> <memnode cellid='0' mode='strict' nodeset='0'/> <memnode cellid='1' mode='strict' nodeset='1'/> </numatune>
- Configure the internal structure of NUMA.Each of the two NUMA nodes has 4 GB memory. The node 0 contains CPU 0 to 7, and node 1 contains CPU 8 to 15.
1 2 3 4 5 6 7
<cpu mode='host-passthrough' check='none'> <topology sockets='1' dies='1' clusters='4' cores='4' threads='1'/> <numa> <cell id='0' cpus='0-7' memory='4194304' unit='KiB'/> <cell id='1' cpus='8-15' memory='4194304' unit='KiB'/> </numa> </cpu>
Parent topic: Feature Usage