2

I'm trying to execute a command under some resource limits.

This correctly limits my-bin to just 1 CPU core. I'm able to verify with htop.

$ sudo systemd-run -p AllowedCPUs=0 -- ./my-bin

However, this doesn't work. htop shows all cores active.

$ systemd-run --user -p AllowedCPUs=0 -- ./my-bin

Seems like my user slice is under the correct controllers. I set Delegate=yes for my user slice. I followed this guide.

$ cat /sys/fs/cgroup/user.slice/user-1000.slice/cgroup.controllers    
cpuset cpu io memory pids

Here's my version info.

$ systemctl --version
systemd 247 (247.2-1-arch)
+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYP
T +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 
default-hierarchy=hybrid

Is there some configuration I missed? Or am I misunderstanding how this is supposed to work?

425nesp
  • 406
  • 4
  • 12

0 Answers0