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
11 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 ...
3 votes
0 answers
83 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 ...
  • 31
0 votes
1 answer
24 views

Permission Denied to modify tasks and cpu.shares

As an experiment I was trying to add some processes in tasks and modify some cpu.shares. However I get Permission denied if I try to run commands like I created a folder test inside of /sys/fs/cgroup/...
1 vote
0 answers
24 views

How to avoid cgroup.subtree_control of a delegated unit being reset on service restart

In the systemd v250 environment, when I restart the service, the cgroup.subtree_control is reset. If I modify the value of cgroup.subtree_control, then when I restart the service, systemd will try to ...
  • 141
0 votes
0 answers
56 views

How to limit memory consumption of individual child processes of a (systemd) service?

I am working on an application that processes files in background jobs. The jobs are picked up by a worker process, which spawns a command for each job. The worker supervisor process is running in a ...
  • 11
0 votes
0 answers
51 views

Not being able to create as root

$ sudo touch /sys/fs/cgroup/memory/baloo/memory.limit_in_bytes touch: cannot touch '/sys/fs/cgroup/memory/baloo/memory.limit_in_bytes': Permission denied $ mount | grep cgroup cgroup2 on /sys/fs/...
  • 83
1 vote
0 answers
49 views

systemd/cgroup resource limits -- different behaviour between hosts

I'm heavily confused. I have a physical server running Ubuntu 20.04 and a vagrant (VirtualBox) virtual machine also running Ubuntu 20.04. Both are running with hwe 5.13 kernel and systemd 245 (245.4-...
  • 1,211
0 votes
1 answer
17 views

Excessive syslog messages

I am getting a huge amount of log messages in /var/log/syslog all of the sudden (5GB/day). I think it has to do with my recent adoption of cgroups but I'm not sure. Here is what I see: Jun 29 06:25:...
  • 121
1 vote
1 answer
192 views

How do I get the cgroup path for a podman container?

Is there a way to get the cgroup root path(s) for a podman container? It seems podman inspect does not reveal anything about cgroups. One "hacky" way I've found is to do something like # Run ...
  • 360
2 votes
1 answer
335 views

What is the replacement of memory.swappiness file in cgroups v2

I'm currently migrating from cgroups v1 to cgroups v2. And I can't find the memory.swappiness file that I used in cgroups v1. There are only the following files concerning swap memory.swap.current ...
  • 107
0 votes
0 answers
144 views

Use iptables to filter traffic based on cgroup v2

I have been using cgroups and iptables for a while to make decisions on what applications would be allowed access to the network. For example, to only allow outgoing traffic from my own service: mkdir ...
  • 101
0 votes
1 answer
35 views

Is there any other way to add program to cgroups-v2 instead of giving their pids?

I am trying to learn cgroups-v2 and practicing it. cgroups-v2 document stated that entering pid is the only way to add a program to cgroups-v2. Is there any other way to add a program's executables to ...
's user avatar
0 votes
0 answers
157 views

Isolating a cpu with cupset (cgroup v2)

The latest raspbian OS based on Debian bullseye doesn't support isolcups anymore and it has cgroup v2. The kernel documentation say that cpuset should be used instead of isolcpus. For some application ...
  • 211
2 votes
2 answers
475 views

why rmdir can work well when delete cgroup directory but rm -rf can not?

Here is a cgroup tree. Root node is demo and it has only one child demo/ ├── cgroup.clone_children ├── cgroup.procs ├── cgroup.sane_behavior ├── child │   ├── cgroup.clone_children │   ├── cgroup....
0 votes
0 answers
165 views

Linux: CPU affinity changes itself on NUMA system

I'm running a Dual Haswell Xeon system (12 cores each, plus HT) and I want to restrict all my applications to run only on one of the two CPUs, at least for all programs that I don't explicitly assign ...
7 votes
1 answer
443 views

How can Bash still write to the terminal when blocking access to tty with cgroups?

Environment: OS: CentOS 8 (generic/centos8 Vagrant box) Virtualization: VMware-Workstation 16.1.0 build-17198959 Steps to reproduce: Create a devices new policy cd /sys/fs/cgroup/devices mkdir ...
0 votes
0 answers
38 views

unexpected reset above 90% /tmp usage

There is 1GB /tmp folder on an embedded system with 8GB RAM. No swap is configured. If /tmp grows to its limits, I assume OOM-killer does its job and one random service is killed, together with the ...
0 votes
1 answer
483 views

Kubernetes OutOfcpu error when Requests.cpu == Limits.cpu

I'm running Kubernetes Jobs in which I set limits and requests both to the same number of CPUs. In some of these jobs I'm occasionally seeing OutOfcpu errors When I kubectl describe pods PODNAME I see ...
  • 1,020
3 votes
2 answers
83 views

Understanding order of operation of cgroup configuration files in /etc/systemd/system/*

I am using a Red Hat 8.1 server. I want to limit users using cgroups. I don't understand the order of operation when reading *.conf. I currently have the files : [root@log01 ~]# cat /etc/systemd/...
0 votes
0 answers
157 views

Systemd cgroup Problem - CPUQuota doesn't work for high values, but for low values it does

We have a GitLab Server with a docker-executor runner on the same machine. To keep GitLab responsive we want to limit docker to a certain amount of CPU usage. After some research I found several ...
  • 101
0 votes
0 answers
42 views

How can I tell the CPU "request" of a cgroup

Whenever I deal with cgroups, I do it through higher level tools like Docker or Kubernetes, these tools allow me to set cgroups in a more "human" way. I just need to say stuff like "1.5 ...
  • 191
2 votes
2 answers
117 views

Is cgroup a type of namespace?

Is cgroup a type of namespace? I am asking this because I have seen blogs talking as if cgroup and namespaces are different. However, in different linux commands , cgroup is considered as a type of ...
  • 1,642
2 votes
1 answer
432 views

Cgroup and process memory statistics mismatch

I am trying to set up some monitoring to see when a service is using too much memory. The memory usage can be read from two places: the /proc/<pid>/status for the pid, or the /sys/fs/cgroup/<...
  • 582
1 vote
1 answer
149 views

Automatically moving forked processes in a different cgroupv2

I've been using apache2-mpm-itk with cgrulesengd in cgroupv1 to automatically classify the child processes that apache2-mpm-itk spawns when servicing web requests for different vhosts for about 3 ...
  • 1,377
0 votes
1 answer
83 views

Linux cgroupsv2 missing PSI files

I am currently trying to read the Memory and IO Pressure from the cgroup filesystem. I can confirm that I am indeed running cgroupsv2 as the output from cat /sys/fs/cgroup/cgroup.controllers gives me ...
0 votes
2 answers
651 views

What are CGroup Slices Used For

Just been paying attention to systemctl status' branching structure. I realized I was making up stories to explain why it looked like that but had no clue of what it meant. I can't find much info on ...
0 votes
1 answer
372 views

How can cgroup.subtree_control be populated in Docker's private cgroup namespace?

For cgroupv2, by default Docker uses a private namespace for cgroups. This is controlled by the --cgroupns flag for docker run and the default-cgroupns-mode daemon option. I need to create child ...
  • 113
5 votes
1 answer
218 views

EBUSY when trying to add process to cgroup v2

I'm playing with cgroups v2 on Fedora 35 (kernel 5.15.5-200.fc35.x86_64). I was able to test cpu, cpuset and pids controllers without any problems. But for memory, hugetlb or io I'm having troubles. ...
1 vote
1 answer
335 views

unable to append to cgroup v2 cgroup.subtree_controller

I have a tinker board 2s (like raspberry pi) running debian on kernel 4.4.194. I enabled cgroups v2 by adding systemd.unified_cgroup_hierarchy=1 into the /boot/cmdline.txt file as supposed to. the ...
  • 111
1 vote
1 answer
158 views

High system load when container hits its memory limit

My server recently crashed, because the GitLab docker/nomad container reached its defined memory limit (10G). When hitting the limit, the container spent 100% of its cpu time in kernel space. (The ...
  • 111
0 votes
0 answers
668 views

How can I find out which device or resource is busy?

I'm looking for advice troubleshooting an issue related to 'cgroups' on Ubuntu 18.04. An application (Mullvad) gives the following error in journalctl: [mullvad_daemon][ERROR] Error: Unable to ...
2 votes
1 answer
281 views

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 ...
  • 321
0 votes
0 answers
162 views

cgroup v2: how to put a user service in a custom slice outside user.slice

My observation is that if systemd-run --slice my.slice --user sleep 10s is run, then this my.slice is not in the root cgroup. Instead, it appears in [root_cgroup]/user.slice/user@1000.service/my.slice/...
  • 321
0 votes
0 answers
133 views

Settings of cgroup are resetting to default

I have strange behavior of cgroup. I set group to limit CPU. All ok, all work. But next morning all my settings are resetting to default. What I do: I ran script and I see proc: cat /proc/[PID]/cgroup ...
  • 157
2 votes
0 answers
304 views

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

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 ...
's user avatar
0 votes
0 answers
71 views

Kill all processes spawned by python script

I want to run a python script, that spawns for example Google Chrome. It should return an error if script fails. I tried to use systemd-run --scope --collect python script.py, but without a success - ...
2 votes
1 answer
205 views

systemd ignores drop-in configuration files - what am I doing wrong?

On one of my machines with Debian Buster (which ships systemd 241), I wanted to watch resource usage via systemd-cgtop. When I started this utility, I was seeing memory usage, but neither CPU usage ...
  • 2,277
2 votes
0 answers
77 views

How do I report the max RSS of a cgroup?

I would like to monitor the peak RSS a cgroup has used since it was created. By "peak RSS" I mean: the sum of all processes' RSS at the point in time where that sum is the greatest. I ...
0 votes
1 answer
153 views

Limiting a single process's memory without children using cgroups

I need to limit memory usage for a process, but ignore all its children. How do I do that? Using cgroups is preferred, but not necessary. Note: I want to ignore all current and future children of the ...
2 votes
0 answers
125 views

Make memory.limit_in_bytes ignore file cache

When using cgroups (either standalone or as part of docker or kubernetes) memory.limit_in_bytes counts file cache towards the processes memory usage. This has an unexpected side effect that I'm trying ...
  • 121
0 votes
0 answers
88 views

How to set memory limit for multiple NUMA nodes separately in cgroup?

I'm creating a cgroup using cgcreate -g cpuset,memory:/test-cgroup Then I set cpuset.mems=0,1 and memory.memory.limit_in_bytes=1073741824 for test-cgroup I assume the 1GB of memory limit is the ...
1 vote
0 answers
35 views

cgroups - controlling memory

I am trying to understand how cgroups and namespaces work. I have been able to get to a point where I can execute example programs in example cgroups and see how the memory resource can be controlled. ...
3 votes
1 answer
1k views

Debian 11, works fine but strange systemd error happen

I'm on Debian 11, on a Virtual Machine using kvm My user can login via console, ssh and lightdm. But there is an error with systemd sudo systemctl status user@1000.service ● user@1000.service - User ...
  • 11.2k
1 vote
0 answers
52 views

How do I make a Linux process believe it is using 100% of CPU while limiting it with a cgroup?

Cgroups allow artificially limiting CPU time available to a process using cpu.cfs_quota_us and cpu.cfs_period_us parameters. This however results in a discrepancy when the program monitors its CPU ...
  • 5,216
2 votes
1 answer
381 views

Limiting a program's memory usage using `systemd-run`

I'm on Debian Bullseye (hence cgroups v2, afaik) and I'm trying to use systemd-run to limit the memory usage of a process. I need the process to be killed when it goes out of memory (I'm setting up ...
  • 211
1 vote
0 answers
413 views

Enabling the memory controller on cgroup v2 on fedora 34

I am trying to install kubernetes on a fedora34 machine. The preflight fails with the following error: [ERROR SystemVerification]: missing required cgroups: memory I have been trying to find out ...
1 vote
0 answers
158 views

cgroup memory usage is different from sum of memory usage of sub cgroups

The memory usage I see here: sudo cat /sys/fs/cgroup/memory/memory.usage_in_bytes is different the from the sum of memory usage of the sub cgroups, which I calculated by getting all the sub cgroups ...
1 vote
1 answer
201 views

CentOS 8: How to add a user to a cgroups?

How to add a user to a cgroups in CentOS 8?
  • 223
1 vote
0 answers
250 views

How can I learn why kswapd has very low page reclaim efficiency?

Problem/context I have a (managed) Postgres 10.16 instance running on Fedora 32 in a systemd-nspawn container. Periodically, I see a big spike in "system" CPU usage in our metrics, ...
  • 111
4 votes
0 answers
619 views

How do I send signal to all processes in a cgroup?

kill $(< /sys/fs/cgroup/freezer/<name>/tasks ) works, but looks clumsy, produces a warning if cgroup is empty and may hit command line length limit. pkill -F does not accept cgroup tasks file ...
  • 5,216

1
2 3 4 5 6