I make certain CPUs to go offline using the command
echo 0 > /sys/devices/system/cpu/cpu$cpu/online
Post which my nproc
, grep "processor" /proc/cpuinfo
and lscpu
confirms that the CPU is offline. In such a scenario:
No process is killed, that would be a disservice.
When a CPU is put offline, its tasks are migrated:
All processes are migrated away from this outgoing CPU to new CPUs. The new CPU is chosen from each process’ current cpuset, which may be a subset of all online CPUs.
from Official Kernel documentation
This leaves open the question of tasks that were pinned to that specific CPU. You can dig into the kernel to see that the fallback is to unpin those task from the offlined CPU.
Their new affinity mask is set to all the possible CPUs.