Questions tagged [cgroups]

Linux cgroups (control groups) allow limiting and accounting for resources on a system, including CPU, memory, and block I/O.

There are two completely distinct versions of cgroups. They can be referred to as "cgroup v1" and "cgroup v2." Any literature you find around on the web that doesn't specify one or the other is almost certainly about "cgroup v1."

References:

Note that this same page provides a good writeup on the issues with v1 (and rationale for v2) which may prove quite useful even for users of cgroup v1.

322 questions
13
votes
1 answer

How do cgroups interact with non-cgrouped processes?

I have 3 processes on a single core machine. Each process is exactly the same and burns CPU as fast as it can (tight loop). Two of them (A and B) are launched with cgexec in separate groups with shares set to 512 and 512. The third (C) is…
10
votes
3 answers

how do I check if system is using cgroupv1?

docker can only use cgroupv1, but fedora by default only use cgroupv2. How do I check if system is cgroupv1 compatible? So far answer in this question can only determine if cgroupv2 is installed. But it cannot determine if unified_cgroup_hierarchy…
Wang
  • 1,296
10
votes
2 answers

Using cgroup to limit program memory as it's running

Let's say I have created a cgroup and attach a memory limit of 200MB to the cgroup. I then run a memory-intensive process inside the cgroup, and it uses up its limit of 200MB. As the process runs, is it possible to lower the memory consumption of…
7
votes
1 answer

Place all processes belonging to user in a cgroup

I've been reading about cgroups because I want to create a resource-limited sandbox on an embedded linux machine. As I understand it, given a binary that we want to run in isolation we can launch it as a member of some cgroup that we define. We can…
3
votes
0 answers

Why don't I have cgconfig service although I installed cgroup-tools?

I am using Debian 11 Bullseye. I have installed cgroups-tools and I created a cgconfig.conf file. When I start the cgconfig servive by using: sudo systemctl start cgconfig.service it gives this error: *Unit cgconfig.service could not be found.* I…
user458762
3
votes
1 answer

cgroups: how to detach a process from cgroup

I have created a cgroup mygroup in my system and running a process under it cgexec -g memory,cpu:groupname/mygroup someprocess Now after some time when i feel there is no need to worry about the cpu and memory, how to detach the process from cgroup…
Santhosh
  • 409
2
votes
1 answer

cgroup v2: how to set `cpuset.cpus` for a slice in a unit file

From man systemd.resource_control, it seems that there is no options for cpuset controller. Then how to set it in a unit file? My purpose is to have the values set during boot time. I know how to do it after booting by directly writing numbers into…
doraemon
  • 421
2
votes
0 answers

Limiting CPU hyperthreads that cgroup tasks are allowed to access?

Just a quick question about using CPUSET to limit the CPUs a cgroup can access when using a multi-core CPU with hyper-threading. The documentation linked above says: cpuset.cpus (mandatory) specifies the CPUs that tasks in this cgroup are…
tinlyx
  • 678
2
votes
1 answer

cgconfig.conf file is missing

I installed cgroup on my linux (3.19.0+) using the following command: apt-get install cgroup-bin However I can't find the file /etc/cgconfig.conf. Did I miss anything?
NaSh
  • 232
2
votes
0 answers

cgroups: cgclassify processes of other users

As root I've create a cgroup which limits cpu and memory usage. cgcreate -g cpu,memory:matlab_sandbox cgset -r cpu.shares=250 matlab_sandbox cgset -r memory.limit_in_bytes=8G matlab_sandbox Now I'm wondering why I can only enforce the limits on my…
Lugaxx
  • 675
2
votes
0 answers

cgroup memory.usage_in_bytes always zero for some tasks

I am trying to use cgroup to manage memory on a HPC cluster using torque queue manager on CentOS 6 machines. Just to test I login to a node running a job where I have: pbs_mom(12184)─┬─sh(24312)───9809188.launchp(24339)───fcgene(24362) …
raines
  • 284
2
votes
1 answer

Adding entire session to a cgroup

How would I add entire session to a cgroup. cgclassify seems to add just the specified PID.
Šimon Tóth
  • 8,238
1
vote
0 answers

cgroup file in a created group seemingly disappears after a day (including suspend)

I've started using cgoups (cgreate -g cpu:gr1 / cgset -r cpu.max / cgexec) regularly recently. More than once I've noticed I create cgroup and run a command as above, then after a day or two (of other work with linux system not restarted, however…
Alex Martian
  • 1,035
1
vote
0 answers

Adding a program with variable PIDs to cgroup

Specifically, I am seeking a solution that can add the program to the cgroup in a seamless and consistent manner. What is the recommended approach to dynamically adding a program to cgroup, such as Firefox, without having to manually track its PID…
1
vote
1 answer

Creating a cgroup2 controller, getting: echo: write error: No such file or directory

When I try to create a pids controller in cgroup2, I get bash: echo: write error: No such file or directory What am I doing wrong, # cd /sys/fs/cgroup/unified # mkdir newgroup # cd newgroup/ # echo '+pids' > cgroup.subtree_control bash: echo:…
Evan Carroll
  • 30,763
  • 48
  • 183
  • 315
1
2