On Red Hat 8.7 on x86_64 I would like to restrict process to be allowed to use only 50% of CPU time.
I tried to limit a process with cgroups following Red Hat tutorial Setting CPU limits to applications using cgroups-v1 and I have successfully created cgroup and limit CPU time on specific process on my test computer.
Now I would like to do the same on production computer but I run into a problem. I did:
Create new cgroup
mkdir /sys/fs/cgroup/cpu/Example/
Created 50% CPU time limitation
echo "1000000" > /sys/fs/cgroup/cpu/Example/cpu.cfs_period_us
echo "500000" > /sys/fs/cgroup/cpu/Example/cpu.cfs_quota_us
Add process to cgroup
echo "2335776" > /sys/fs/cgroup/cpu/Example/cgroup.procs
Command returns error:
bash: echo: write error: Invalid argument
What does this error means and how to add process to cgroup?