Questions tagged [cgroups]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
21 views

How to make cgroup V2 persist accross system reboot in RHEL 7

I am using RHEL 7. The default Cgroup hierarchy for the system is Cgroup V1. I need the system to have both Cgroup V1 and Cgroup V2 hierarchies co-existing, and I am achieving that by manually ...
Nitin Kumar's user avatar
1 vote
1 answer
15 views

cgexec not placing child process in correct cgroup

I have made two cgroups: sudo cgcreate -g cpu,memory:rustserver sudo cgset -r memory.max=150000000 rustserver sudo cgset -r cpu.max=25000 rustserver sudo cgcreate -g cpu,memory:pyexecutor sudo cgset -...
O'Niel's user avatar
  • 157
0 votes
0 answers
60 views

How is the order of processes killed in cgroup v2 when out-of-memory?

I'm using cgroup v2 on Ubuntu 22.04 to limits users in a group. I'm wondering how the processes are killed when out-of-memory (OOM). For an instance: The computer has 100G memory. I have a group of 4 ...
hffqyd's user avatar
  • 1
0 votes
0 answers
18 views

Where hugetlb controller is auto enabled?

One kvm virtual machine (8 vcpus+8G memory) of Ubuntu 22.04 with cgroup2 system, cat /sys/fs/cgroup/cgroup.subtree_control hugetlb controller included; But another kvm vm (4 vcpus+4G memory) of ...
Foochair Wien's user avatar
0 votes
0 answers
267 views

Troubleshooting Slurm cgroups Plugin on Ubuntu 22.04

I'm facing a challenging issue with the Slurm cgroups plugin on a system running Ubuntu 22.04. We're relatively new to Slurm and started using it for better resource management in complex computing ...
Francisco Maria Calisto's user avatar
0 votes
0 answers
139 views

Orangepi zero 2w. Debian 12 installed. How to pass a kernel parameter at startup time?

I try to install Home Assistant on debian 12 installed on orangepi zero 2w micro. Home Assistant insists on cgroups v1. But debian 12 supports cgroups v2. docker docs said that I can switch to ...
user8866796's user avatar
1 vote
1 answer
115 views

CentOS systemd places service subprocesses started with `sudo` in `user.slice` (instead of `system.slice`)

Subprocesses that are created using sudo within a systemd service are placed in the user.slice. This behavior has been observed only on CentOS 8 (x86_64 20230606) and not on Ubuntu 20.04.5 LTS, where ...
flashy's user avatar
  • 13
1 vote
1 answer
105 views

systemd resource control - IOWriteIOPSMax not working?

I'm trying to limit IO for a specific unit, but the IOWriteIOPSMax attribute does not appear to make a difference. I initially tried IOWeight, but that is more challenging to test, the docs on IOPSMax ...
morisja's user avatar
  • 13
0 votes
1 answer
331 views

How can I change cgroup memory limits in Redhat 9 or Amazon Linux 2?

I have a docker container which requires 16GB RAM in order to run, plus some extra from some processes it starts. The memory consumption on the machine seems to peak at 60-70% from total memory (64GB)....
ezorethyk's user avatar
0 votes
0 answers
13 views

cgroups: can specific core of cpu be limited for time quota?

As far as I've read man pages, it is not possible to limit specific core to say 50% while limiting the whole CPU to 25%. Only options are mimiting set of cores and total processor time quotas. ...
Alex Martian's user avatar
  • 1,005
1 vote
0 answers
25 views

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 ...
Alex Martian's user avatar
  • 1,005
0 votes
0 answers
44 views

API for querying all cgroups applied to a process in Linux

I'm working on some software that needs to know its own maximum accessible memory. On Linux, this will depend on the cgroups. From what I have gathered, a process can read from /proc/self/cgroup to ...
Migwell's user avatar
  • 407
-1 votes
1 answer
154 views

Limiting process memory usage with systemd-run not working as expected

I'm trying to limit the memory usage of Chrome with systemd-run by starting it with: systemd-run --scope \ -p MemoryMax=16G \ -p MemoryHigh=15G \ -p CPUWeight=70 \ -p StartupCPUWeight=100 \ /...
apidae's user avatar
  • 101
0 votes
1 answer
39 views

Is there a way to prevent a descendant thread from getting into cgroup of its ancestor thread automatically?

I write some threads of my app to a Linux cpu cgroup, created by me, explicitly (let us talk e.g. about v1 for now, but if you know a way for v2, that would be also great). However, I see that ...
JenyaKh's user avatar
  • 346
0 votes
1 answer
43 views

cgroups between containers

I am trying to find out a way to move a process back to the original cgroup after I moved it to a new cgroup under my hierarchy. The situation is k8s cluster, I have a pod on a node (container) and I ...
Aviram's user avatar
  • 1
0 votes
1 answer
270 views

how to add PID inside cgroup.procs with non-root privileges in cgroup-v2 in Ubuntu

I created cgroup in /sys/fs/cgroup. I called it testGrp and I need this cgroup to be controlled by non-root user so I changed the ownership of the whole cgroup directory /sys/fs/cgroup$ sudo chown -R ...
Belal Elkady's user avatar
2 votes
1 answer
501 views

Receive a memory pressure event with cgroups v2 when no memory limit is set

With cgroups v1, it is possible to listen for events about memory pressure. According to the docs, one needs to Create a new eventfd Open memory.pressure_level for reading Open cgroup.event_control ...
Caesar's user avatar
  • 131
0 votes
0 answers
76 views

How do you mark both incoming and outgoing packets to a cgroup v1 net classifier?

I'm attempting to isolate and tcpdump all network traffic from a single process, following the instructions here:(How to mark packets by program): $ sudo bash # mkdir /sys/...
PFudd's user avatar
  • 173
1 vote
0 answers
67 views

why is process running on cpu core that is disabled in affinity mask

when I run taskset -p 242306 I got following output 3ffffffffffc000000000000000000000000000000000000000000038000000 sorry for the long string, there are 256 cores on the box. used taskset -c -p ...
Lei Yu's user avatar
  • 111
0 votes
0 answers
408 views

Docker Error - cgroup mountpoint does not exist: unknown

I have a Python/Flask application (Docker) that calls a Docker in Docker (DinD) process but when that call happens, I see: 2023-07-07T02:21:28.733399366Z Traceback (most recent call last): 2023-07-...
Perry Hoekstra's user avatar
0 votes
0 answers
32 views

How to setup shared limits for a set of users in cgroup?

In work we have centos server where we can connect and give it things to run. Every now and then someone manages to hog all the resources of the server (either cpu or memory) and everything freezes up,...
tst's user avatar
  • 195
0 votes
1 answer
50 views

Is the system limiting my memory?

I am running some code on a shared remote machine. When running several instances in parallel, they relatively quickly die with std::bad_alloc, while a single instance runs much longer (in any case, 1 ...
Bubaya's user avatar
  • 121
0 votes
0 answers
107 views

How to isolate machine using iptables and cgroups in ubuntu

I am trying to isolate a computer from the network. I am running the following commands in linux: #create net_cls folder for cgroup mkdir /sys/fs/cgroup/net_cls #mount the newly created folder mount ...
Mahe's user avatar
  • 101
2 votes
1 answer
219 views

What is the way to enforce daily write limits on a disk partition in linux?

I would like to enforce certain write limits on my disk partitions. I would like to limit the amount of data application can write on a given disk partition on hourly, daily or weekly basis. Is there ...
Virat Manvar's user avatar
2 votes
1 answer
393 views

systemd-run MemoryMax/MemoryLimit don't seem to work

Configured systemd to account for memory: $ grep Memory /etc/systemd/system.conf DefaultMemoryAccounting=yes Write a little executable that allocate a 100M: $ cat test.c #include <stdlib.h> #...
Luke Skywalker's user avatar
2 votes
1 answer
302 views

daemon reload resets cgroup.subtree_control of cgroups

I created a cgroup named mycgroup using mkdir /sys/fs/cgroup/mycgroup. Before executing echo +cpu > /sys/fs/cgroup/cgroup.subtree_control: [root@host ~]# cat /sys/fs/cgroup/mycgroup/cpu.max cat: /...
jay's user avatar
  • 31
2 votes
0 answers
238 views

Do I need to stop or pause a container before I export a volume?

To avoid an inconsistent volume backup, I pause (or outright stop) a container before I copy the contents of the volume. Is this still necessary when backing up containers via podman volume export, or ...
Tenders McChiken's user avatar
1 vote
0 answers
43 views

Resource limits getting enforced only for processes in user's terminal not for su [user] from root's terminal

Cgroups v2 is enabled in almalinux 9.1 with kernel 5.14.0-70.22.1.el9_0.x86_64 and systemd 250 (250-12.el9_1.3). Content of /etc/systemd/system/user-1002.slice.d/override.conf: [Unit] Description=User ...
jay's user avatar
  • 31
1 vote
0 answers
41 views

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 ...
user216385's user avatar
0 votes
1 answer
49 views

What does "process changes its effective UID or GID" mean in the cgrulesengd man page?

I am planning to user cgrules.config to move processes stared by a user to my cgroup. The man page(https://linux.die.net/man/8/cgrulesengd) of cgrulesengd says that any time a process changes its ...
Ankit's user avatar
  • 1
1 vote
0 answers
153 views

non-root user starts process belonging to cgroup owned by root

I create a non-root user and then run a simple bash (it just sleeps). However, the process started by that user belongs to a cgroup owned by root. This makes me failing to move the process to the ...
Franz Wong's user avatar
5 votes
1 answer
148 views

Systemd bind rules have no effect in user slice

I want to prevent the user test (1000) from binding to any ports other than say 1537 so according to systemd.resource-control I configure SocketBindAllow=1537 and SocketBindDeny=any for the user Slice....
Gamification's user avatar
1 vote
1 answer
192 views

How to create a private swap file for a specific process or cgroup in Linux?

I'm currently attempting to generate a swap file in Linux that is exclusive to a particular process or cgroup. After going through the LWN article which discusses the patches that enable this ...
Elior Gigi's user avatar
3 votes
0 answers
220 views

When using cgroup v2, is there command line tool equivalent to cgexec command?

As we know, there is command-line management suite, among which there is cgexec command, in cgroup v1. We can start a process immediately under control group. When we are using cgroup v2, is there ...
Cu635's user avatar
  • 39
3 votes
1 answer
405 views

How to add "Freezer" control group to Fedora 36, and does it matter for virtualization if I don't?

I'm trying to (re)install KVM on my development system (which has been often-upgraded over the years since Fedora twenty-something, and on which kvm was installed many moons ago and then forgotten ...
nigel222's user avatar
  • 317
1 vote
1 answer
692 views

Limit CPU usage with cgroup v2 as non-root user: permission denied

I'm trying to limit the CPU usage of a process using cgroups v2. The hierarchy is already created and the limits are set, I just need to write the pid into the cgroup.procs file. The path is /sys/fs/...
zlatonick's user avatar
  • 149
1 vote
1 answer
345 views

cgroup v2 io.max limit not applied

I can't seem to be able to apply io.max limit through cgroups v2 on Rocky Linux 9. Setup: # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS ... ├─nvme0n1p5 259:5 0 444.9G 0 part │ └─...
mike's user avatar
  • 105
1 vote
1 answer
142 views

Does Linux enforce memory cgroup limits when the page is touched?

When a process first touches a page and the page is added to the mem_cgroup, if that page puts the mem_cgroup over its limit does the kernel immediately signal quota violation?
luke's user avatar
  • 11
2 votes
1 answer
430 views

Configure cgroups v2 for fair resources sharing between users

Is there a way to restrict system resources to users? I know that used to exist a way of forcing every newly spawned process of a user into the specified cgroup by using cgred service along with /etc/...
Centuri0n's user avatar
2 votes
0 answers
54 views

Can systemd be used to dynamically set a system-wide write bandwidth limit for a block device?

I would like to dynamically set a system-wide limit on the write bandwidth for certain block devices. The devices are pluggable and managed by our own service. Currently the service sets/removes the ...
starblue's user avatar
  • 616
2 votes
0 answers
183 views

Why does my control group show no memory usage in cgget and systemd-cgtop, despite containing a process using significant memory?

I'm trying to implement a solution to this problem using control groups, which I have never worked with before. As a first step, I thought I would create a control group, add a process to it, and view ...
Zorgoth's user avatar
  • 393
2 votes
1 answer
1k views

Setting up cgroups with /etc/cgconfig.conf failed with Cgroup, requested group parameter does not exist

I'm looking at getting cgroups working on my linux machine and well it's been a pain. I feel like this should be a lot easier as resource management is pretty key to a healthy desktop environment ...
Nate-Wilkins's user avatar
2 votes
1 answer
879 views

Using cgroups v2 without root

On operating systems which use cgroups v2, such as Ubuntu 22.04, I am unable to 'cgexec' any process without being root. This type of code used to work fine, if I use root once to set the permissions ...
Chris Jefferson's user avatar
1 vote
0 answers
393 views

cgroup controller delegation not passing down the hierarchy

Forgive me if I butcher some terms as the whole cgroup thing is new to me... Background story is I'm trying to get kind to run in Rocky Linux 8 and/or 9, which have rootless podman. I've gotten both ...
bfos's user avatar
  • 111
2 votes
0 answers
379 views

How to get the current cgroup ID from C/C++?

The eBPF helper functions define bpf_get_current_cgroup_id for eBPF programs, which does the obvious thing u64 bpf_get_current_cgroup_id(void) Return A 64-bit integer containing the current ...
user547386's user avatar
1 vote
0 answers
250 views

Can systemd-run create temporary cgroups for temporary commands with resource limits?

I'd like to limit the resource consumption of temporary commands with cgroup created by systemd-run, similar to what cgcreate does instead, but I'm not sure if that makes sense? I'd like to make sure ...
山河以无恙's user avatar
2 votes
2 answers
689 views

How to enable HugeTLB controller in cgroup v2 on Ubuntu

I am trying to enable HugeTLB Controller on cgroup v2 on my system but can't figure out how. This is the list of controllers on my system: cat /sys/fs/cgroup/cgroup.controllers cpuset cpu io memory ...
Harshdeep Gupta's user avatar
4 votes
0 answers
64 views

Restrict NFS to only run on certain cores

I have an application that likes to use the very first core in a core complex. For example, assuming CPU has CCX of 4, it would run the load on core 0,3,7,11,…. This process is time sensitive and ...
Trevor K Smith's user avatar
2 votes
0 answers
35 views

Available memory, respecting cgroups

I'm trying to accurately scale parallelism for a build process, where a set of invocations use a lot of memory. Is there a good tool to find out the amount of memory that is actually available to the ...
Simon Richter's user avatar
3 votes
0 answers
1k views

cgroups v2 cpuset doesn't take an effect without process restart

I'm trying to isolate some CPU cores for latency-sensitive processes using the cpuset controller in cgroup v2. I created a group lowlatency: mkdir /sys/fs/cgroup/lowlatency and restricted it to use ...
Maxpain's user avatar
  • 31

1
2 3 4 5
7