Pcornel
Virtualization · CPU Virtualization

CPU Pinning

Cheat sheet · https://pcornel.dk/topic.php?topic=3481

Back to the Topic

Answer

CPU pinning maps each vCPU to a fixed physical core (for example virsh vcpupin or a Proxmox affinity setting) to give latency-sensitive or NUMA-aware workloads predictable performance, at the cost of flexibility and density.

Remember

  • Pinning without isolation still shares cores.
  • Pinned VMs reduce host flexibility.
  • Pin to cores in one NUMA node.

First checks

  • virsh vcpupin <vm> 0 2 — pin vCPU 0 to pCPU 2
  • virsh emulatorpin <vm> — pin emulator threads
  • cat /proc/cmdline | grep isolcpus — isolated host CPUs

Verify in this order

vCPU → dedicated pCPU

Where it usually breaks

First mismatch in host capability/IOMMU/NUMA → hypervisor allocation/mapping → virtual hardware model → guest driver/enumeration → workload use; preserve identity/native error/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=3481

Confirmation

Confirm action

Continue?