Frequently Asked Question
What is CPU pinning and what does isolcpus actually do?
Pinning (or affinity) ties a process or thread to a fixed set of CPUs.
You set it from user space with taskset -c 4-7 ./myprog or from C with
sched_setaffinity(); from cgroup v2 it's cpuset.cpus. Pinning lets a
long-running thread keep its caches warm and avoid cross-socket migration,
which on NUMA hardware can be the difference between 10 ns and 100 ns
memory accesses. Real-time and high-frequency-trading workloads pin
aggressively; ordinary servers usually don't need to.
isolcpus=2-15 is a kernel command-line argument that goes further: it
tells the scheduler to not place any task on those CPUs unless the task
explicitly asks (via affinity). The cores sit empty by default, available
only to processes you have pinned to them. Combined with nohz_full=2-15
(skip the scheduler tick on those cores when only one task is running) and
rcu_nocbs=2-15 (move RCU callbacks elsewhere), you get
microsecond-jitter-class CPUs reserved for a single workload. Note that
isolcpus has been considered deprecated in favour of cpuset-based
isolation since around 2017, but it is still widely used because it is
simple.