Hi FauDrei,
Can you give us few examples how to isolate and dedicate CPUs?
To isolate a cpu core you have to edit /boot/cmdline.txt:
root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop isolcpus=2,3
Name
isolcpus — Isolate CPUs from the kernel scheduler.
Synopsis
isolcpus= cpu_number [, cpu_number ,...]
Description
Remove the specified CPUs, as defined by the cpu_number values, from the general kernel SMP balancing and scheduler algroithms. The only way to move a process onto or off an "isolated" CPU is via the CPU affinity syscalls. cpu_number begins at 0, so the maximum value is 1 less than the number of CPUs on the system.
This option is the preferred way to isolate CPUs. The alternative, manually setting the CPU mask of all tasks in the system, can cause problems and suboptimal load balance
After rebooting you can check the result with:
top
Tasks: 109 total, 1 running, 108 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.6/1.3 2[ ]
%Cpu1 : 0.6/3.2 4[ ]
%Cpu2 : 0.0/0.0 0[ ]
%Cpu3 : 0.0/0.0 0[ ]
GiB Mem : 21.3/0.724 [ ]
GiB Swap: 0.0/0.000 [ ]
To retrieve or set a process's CPU affinity you have to use
taskset.
If you want MPD assigned to core 3 you have to edit /usr/lib/systemd/system/mpd.service:
[Unit]
Description=Music Player Daemon
After=network.target sound.target
[Service]
ExecStart=/usr/bin/taskset -c 3 /usr/bin/mpd --no-daemon
Restart=always
[Install]
WantedBy=multi-user.target
Reload the daemon:
systemctl daemon-reload
And restart the service:
systemctl restart mpd
Frank