Rate This Document
Findability
Accuracy
Completeness
Readability

Binding Cores and Memory for VMs

You are advised to bind CPUs in 1:1 mode and ensure that the memory access and the bound CPUs are on the same die to achieve optimal performance.

  1. For details about how to bind cores and memory for VMs, see Setting 1:1 Core Binding and Same-Die Memory Access in the KVM VM Tuning Guide. For details about the VM XML configuration file, see 2 in this section.
  2. The following is an example of how to bind CPUs in 1:1 mode. You can refer to this example when configuring the VM XML configuration file.
    Four vCPUs are bound and 16 GB memory is allocated in this example. Adjust the parameters as required.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    <domain type = 'KVM'>
    ...
      <vcpu placement='static'>4</vcpu>
      <cputune>
        <vcpupin vcpu='0' cpuset='4'/>
        <vcpupin vcpu='1' cpuset='5'/>
        <vcpupin vcpu='2' cpuset='6'/>
        <vcpupin vcpu='3' cpuset='7'/>
        <emulatorpin cpuset='4-7'/>
      </cputune>
    ...
      <numatune>
        <memnode cellid='0' mode='strict' nodeset='0'/>
      </numatune>
    ...
      <cpu mode='host-passthrough' check='none'>
        <topology sockets='1' dies='1' clusters='1' cores='4' threads='1'/>
        <numa>
          <cell id='0' cpus='0-3' memory='16777216' unit='KiB'/>
        </numa>
      </cpu>
    ...
    <domain>