0

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:

  1. Create new cgroup

    mkdir /sys/fs/cgroup/cpu/Example/

  2. 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

  3. 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?

folow
  • 101
  • 2
  • According to documentation I have tried: `echo 2335776 | sudo tee /sys/fs/cgroup/cpu/MyGroup1/tasks` and command executes successfully. But for some reason CPU usage is not restricted for those processes. Any idea why? – folow Mar 23 '23 at 06:43

0 Answers0