Pcornel
Browse topics
Options
Recent
Favorites
Virtualization · Technical reference

CPU Pinning

Direct 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.

When to use this

Use this when a latency-sensitive VM needs fixed cores, such as real-time, NFV or a database aligned to NUMA.

First 30 seconds

1. Pinning maps vCPUs 1:1 to pCPUs for predictable latency (NFV, real-time).

2. Isolate pinned CPUs from host tasks.

3. Pin within one NUMA node.

4. Pin emulator/IO threads separately.

5. Pinned VMs cannot share those cores.

Operational verification

vCPU → dedicated pCPU

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Pinning vCPUs to both hyperthreads of the same core for unrelated VMs.
  • Pinning without isolating host cores (isolcpus), so host tasks still run there.
  • Pinning across NUMA nodes.
  • Forgetting emulator and I/O threads, which still run on other cores.
Platform / version applicability
virtualization-hardware
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformvirtualization-hardware
Scope / prerequisiteUse this when a latency-sensitive VM needs fixed cores, such as real-time, NFV or a database aligned to NUMA.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Checks Verify boundary
virsh vcpupin vm01
virsh emulatorpin vm01
cat /proc/cmdline | grep -o 'isolcpus=[^ ]*'
taskset -pc <qemu-pid>

Pinned vCPUs should map to isolated physical cores on one NUMA node.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Pinning without isolation still shares cores.
  • Pinned VMs reduce host flexibility.
  • Pin to cores in one NUMA node.
Key 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
ReferenceImportant terms & boundaries1 section · depth on demand

In depth

CPU pinning maps each vCPU to a dedicated physical core (or thread), usually combined with isolating those cores from the host scheduler. It gives predictable latency for NFV, real-time, gaming/passthrough and some HPC workloads.

<cputune>
  <vcpupin vcpu='0' cpuset='4'/>
  <vcpupin vcpu='1' cpuset='5'/>
  <emulatorpin cpuset='0-1'/>
</cputune>
# host kernel: isolcpus=4-15 nohz_full=4-15 rcu_nocbs=4-15

Pin within one NUMA node, keep emulator/IO threads on separate cores, and accept that pinned VMs cannot be overcommitted or freely migrated.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Configuration

virsh vcpupin vm01 0 4          # vCPU 0 → host CPU 4
virsh vcpupin vm01 1 5
virsh emulatorpin vm01 2-3      # QEMU threads elsewhere
virsh vcpuinfo vm01

Documented example, not captured output. Proxmox: affinity: 4-7 in the VM config. For real-time or NFV, also isolate the host cores (isolcpus, nohz_full) and use huge pages, and keep pinned cores within one NUMA node.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docvirtualization-hardware current

Authoritative/upstream documentation reviewed for bounded claims in CPU Virtualization → CPU Pinning. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://libvirt.org/docs.html · confidence 94%
Confirmation

Confirm action

Continue?