CPU Affinity
Cheat sheet · https://pcornel.dk/topic.php?topic=3480
Answer
CPU affinity restricts which physical cores a VM's vCPUs may run on. It can isolate workloads or satisfy licensing, but it limits the scheduler, can block live migration and often hurts more than it helps.
Remember
- Affinity limits the scheduler and can raise ready time.
- Affinity can block DRS and live migration.
- Licensing affinity is a legal, not technical, reason.
First checks
virsh vcpupin <vm>— vCPU affinitytaskset -pc <pid>— process affinityqm config <vmid> | grep affinity— Proxmox affinity
Verify in this order
affinity mask → scheduler restricted → pCPUs
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=3480