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.

311 questions
40
votes
5 answers

How do I check cgroup v2 is installed on my machine?

I want to try cgroup v2 but am not sure if it is installed on my linux machine >> uname -r 4.14.66-041466-generic Since cgroup v2 is available in 4.12.0-rc5, I assume it should be available in the kernel version I am…
user3397467
  • 503
  • 1
  • 4
  • 5
33
votes
1 answer

How to limit a systemd service to "play nice" with the CPU?

I have a systemd service (a CI runner) that tends to bog the system down with very CPU intensive jobs. I caught the load average flying over 100 just now and want to put a stop to that nonsense. Nothing else on the system is limited in any way, so…
Caleb
  • 69,278
  • 18
  • 196
  • 226
30
votes
1 answer

How to use cgroups to limit all processes except whitelist to a single CPU?

There is a guide to cgroups from Red Hat which is maybe sort of kind of helpful (but doesn't answer this question). I know how to limit a specific process to a specific CPU, during the command to start that process, by: First, putting the following*…
Wildcard
  • 35,316
  • 26
  • 130
  • 258
20
votes
3 answers

receive signal before process is being killed by OOM killer / cgroups

In our cluster, we are restricting our processes resources, e.g. memory (memory.limit_in_bytes). I think, in the end, this is also handled via the OOM killer in the Linux kernel (looks like it by reading the source code). Is there any way to get a…
Albert
  • 639
  • 2
  • 5
  • 17
18
votes
1 answer

Turning off swapping for only one process with cgroups?

I would like to turn off swapping for only one process. Swap should work as usual for the other processes. How I can implement this with cgroups?
iNode
  • 191
  • 1
  • 3
18
votes
4 answers

Simplest possible secure sandboxing (limited resources needed)

I'm working on a project that implements distributed simulations: arbitrary code is executed on multiple nodes and the results are later collected and aggregated. Each node is an instance of an Ubuntu Linux virtual machine and runs a master process…
StephQ
  • 281
  • 2
  • 3
17
votes
4 answers

Does managing cgroups require root access?

I am trying to work with control groups on two different operating systems (Ubuntu and CentOS). There are few concerns that I would like to ask. I am trying to create a control group using the cgcreate command, and it looks like it requires root…
Rambo
  • 301
  • 2
  • 5
16
votes
3 answers

How to create user cgroups with systemd

I use unprivileged lxc containers in Arch Linux. Here are the basic system infos: [chb@conventiont ~]$ uname -a Linux conventiont 3.17.4-Chb #1 SMP PREEMPT Fri Nov 28 12:39:54 UTC 2014 x86_64 GNU/Linux It's a custom/compiled kernel with user…
lord.garbage
  • 2,323
  • 5
  • 27
  • 41
15
votes
2 answers

Why is conmon in a different cgroup when podman is started with systemd?

Given podman is installed on a linux system and a systemd unit named baz.service: # /etc/systemd/system/baz.service [Service] ExecStart=/usr/bin/podman run --rm --tty --name baz alpine sh -c 'while true; do date; sleep 1;…
mbigras
  • 2,928
  • 6
  • 28
  • 45
13
votes
1 answer

How do I create a systemd scope for an already-existing process from the command line?

I have a machine running the cgroups v2 (unified) hierarchy, so systemd is responsible for managing all cgroups and delegation to the systemd user instance works. I'd like to perform resource control on a group of processes, so I need them together…
derobert
  • 107,579
  • 20
  • 231
  • 279
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…
Micah Zoltu
  • 231
  • 1
  • 5
13
votes
1 answer

Using Linux cgroups to balance CPU performance

I have two dual-core Linux systems installed using Linux cgroups with relatively recent kernels; one is running Debian Squeeze, the other Ubuntu 11.04 Natty Narwhal. I've gotten CPU load balancing with cgroups working a bit better on the Debian…
Greg Smith
  • 3,361
  • 1
  • 15
  • 12
13
votes
2 answers

Weight-based block IO control for VMs

I use KVM to manage my virtual machines. I am trying to limit the resources provided for VMs. I am able to limit the CPU and memory allocated for VMs using libvirt/cgroups. Now I want to control the disk time allotted for each VM by applying some…
sethu
  • 329
  • 2
  • 6
12
votes
2 answers

iptables and cgroups v2 (netfilter's xt_cgroup)

I can't seem to match processes running in cgroup v2 hierarchies with the cgroup module of iptables. I am running Linux 4.13.0 with all required modules: $ grep CGROUP CONFIG_CGROUPS=y CONFIG_BLK_CGROUP=y # CONFIG_DEBUG_BLK_CGROUP is…
Aayla Secura
  • 282
  • 3
  • 9
12
votes
2 answers

What are the effects, if any, of scheduler priorities and policies for threads in an uncontended cpuset?

I have a Linux system where we have used cgroups to create two cpu_exclusive cpusets, A and B, and where we have migrated all user threads and all unbound kernel threads to a cgroup attached to cpuset A. Things running in cpuset A have varying…
acm
  • 257
  • 2
  • 9
1
2 3
20 21