Score:0

Adding process to cgroup returns error "write error: Invalid argument"

ru flag

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 avatar
ru flag
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?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.