For some benchmarking purpose I need to set CPUAffinity for the entire system to limit all process to some cores lets say first 10 cores. This way I can do taskset to override the CPUAffinity and benchmark on a core which is not in the CPUAffinity list.
The reason for doing it is to make sure that during benchmarking of a software, we do not have any disturbance from other users or OS itself.
CPUAffinity was working fine until I upgraded the server from ubuntu 20.04 to ubuntu 22.04. Docker was installed earlier but it did not interfere with systemd cgroups. But now it does interfere and some how sets init affinity to all cores.
I have tried setting cgroup-driver of docker to systemd, it did not help. I might be also viewing the problem wrong.
To reproduce this issue, you just have to install a VM with ubuntu server 22.04, also install docker. Now even if you set CPUAffinity in /etc/systemd/system.conf it will not work. To fix this you will have to remove docker and snapd completely.
For me docker is needed so that's why I am trying to work around this issue.
Also an interesting fact ubuntu 22.04 desktop edition does not seems to have this issue out of box. But I didnt confirm if it has docker/snap installed by default.
Any way thanks for any help.