CPUAffinity is one of the directives to control the CPU affinity of the systemd executed processes.
from the man page of systemd.exec:
# man systemd.exec CPUAffinity= Controls the CPU affinity of the executed processes. Takes a list of CPU indices or ranges separated by either whitespace or commas. CPU ranges are specified by the lower and upper CPU indices separated by a dash. This option may be specified more than once in which case the specified CPU affinity masks are merged. If the empty string is assigned, the mask is reset, all assignments prior to this will have no effect. See sched_setaffinity(2) for details.
Configuring CPU affinity
1. Edit the file “/etc/systemd/system.conf“:
# vi /etc/systemd/system.conf
2. Uncomment “CPUAffinity” line and append the CPU numbers.
CPUAffinity=2,3
3. Restart the server and verify the status of CPU affinity.
Verify
Following commands reveals the CPU affinity of process:
# taskset -p [process ID]
# ps --ppid 2 -p 2 -o uname,pid,ppid,cmd,cls,psr --deselect