Questions tagged [cgroup]

cgroups (control groups) is a Linux kernel feature to limit, account and isolate resource usage (CPU, memory, disk I/O, etc.) of process groups.

cgroups (control groups) is a Linux kernel feature to limit, account and isolate resource usage (CPU, memory, disk I/O, etc.) of process groups. This work was started by engineers at Google (primarily Paul Menage and Rohit Seth) in 2006 under the name "process containers"; in late 2007 it was renamed to Control Groups (due to the confusion caused by multiple meanings of the term "container" in the Linux kernel) and merged to kernel version 2.6.24. Since then, many new features and controllers have been added.

One of the design goals of cgroups was to provide a unified interface to many different use cases, from controlling single processes (like nice) to whole operating system-level virtualization (like OpenVZ, Linux-VServer, LXC). Cgroups provides:

  • Resource limiting: groups can be set to not exceed a set memory limit — this also includes file system cache.
  • Prioritization: some groups may get a larger share of CPU or disk I/O throughput.
  • Accounting: to measure how much resources certain systems use for e.g. billing purposes.
  • Isolation: separate namespaces for groups, so they don't see each other's processes, network connections or files.
  • Control: freezing groups or checkpointing and restarting.

Source Wikipedia

138 questions
3
votes
2 answers

How do I configure LXC to allow the use of SCHED_RR in a container?

Any ideas on how I can configure LXC/cgroups, to allow the use of SCHED_RR for applications in a container? On the internet I have seen mention of unmounting the cpu-cgroup, I have tried that, manually (running umount on the cpu cgroup) that did not…
Henk
  • 59
  • 1
  • 2
  • 4
3
votes
1 answer

cGroups cgred daemon doesnt always move child processes, parent process temporarily in wrong group

So I'm in the process of setting up CGroups on a few servers, and I'm using the documentation pretty heavily to do this. I came across this in section 2.8.1 of the Fedora Resource Management Guide (also weirdly in This redhat guide: The entry now…
Rooster
  • 495
  • 2
  • 7
  • 21
3
votes
1 answer

I/O priority per LVM volume (cgroups)

How can I prioritize LVM volumes I/O performance using cgroups? I know I can use ionice to make changes at the process level but I wish to be able to do this per LV and not per process.
ApriOri
  • 325
  • 1
  • 10
3
votes
1 answer

Allowed cgroup devices for libvirt/lxc container

I want to allow my libvirt/lxc containers to use tun/tap device. In order to do so I for a running container I can add it to the allowed devices by: # echo "c 10:200 rwm" > /sys/fs/cgroup/devices/libvirt/lxc/client-1/devices.allow resulting in: #…
Zabuzzman
  • 733
  • 10
  • 25
3
votes
1 answer

Limit private memory usage per user

I'm using cgroups with the memory controller to set a memory limit for each user (using the memory.limit_in_bytes setting). The problem is that this setting also accounts cache usage. Therefore, if the limit is 1GB, and the user merely downloads or…
Vladimir Panteleev
  • 1,737
  • 5
  • 20
  • 34
3
votes
1 answer

capping VM IO with cgroups

I'm using cgroups to cap disk IO that a VM does by using libvirt's support for cgroups. So, I'm getting the major/minor number of the device from a 'ls -lL' on the drive where the '.img' file for the VM is located. However, when I try to cap the IO,…
vineet
  • 31
  • 2
3
votes
1 answer

How is the cgroup pam module configured?

Linux has a PAM module that manipulates cgroups. How is it configured (what options does it support?)
joeforker
  • 2,399
  • 4
  • 26
  • 35
2
votes
1 answer

cgrulesengd-like support for cgroup v2

I was wondering if there are any best practices for automatically assigning processes to certain v2 cgroups based on a rules file or something similar. Pretty much what cgrulesengd did for v1. I have tried to find something similar but not much pops…
Maran
  • 321
  • 1
  • 4
  • 12
2
votes
1 answer

Automating scheduling and dispatch of compute jobs by different users

I'm going to set up a Linux server (probably CentOS) in a computer science department. The server will be used as a compute server, by people doing research on GPU computing, bioinformatics, or AI. Hypothetically I could just give a shell to each…
gigabytes
  • 123
  • 4
2
votes
0 answers

User Resource management: cgroups + systemd + ssh

I am trying to limit the memory of a single user that keeps crashing our OpenSuse Server. What I have done is as desribed here, to modify the limit of the user's slice via systemctl set-property user-$UID.slice MemoryHigh=20G where $UID is the user…
2
votes
1 answer

Cannot move all processes by a user into cgroup using cgred

I am on a CentOS 7.4 server, and trying to setup CGroups. My cgconfig looks like this: # # Copyright IBM Corporation. 2007 # # Authors: Balbir Singh # This program is free software; you can redistribute it and/or…
user450390
2
votes
2 answers

How to detect if a process was killed by cgroup due to exceeding a limit?

I have a global cgroup defined in /etc/cgconfig.conf that limits the amount of memory. Everytime a user runs a command, I prepend cgexec to add the process and its children to the controlled group. Every now and then the limit kicks in and kills the…
Pavel
  • 1,038
  • 1
  • 11
  • 30
2
votes
0 answers

How do I audit cgroup changes

I have a container process that is mysteriously changing cgroups long after it has been started. How do I track down who/what is changing it? I tried watching my audit log when manually doing a cgclassify command to switch my process and nothing got…
2
votes
1 answer

Cgroups, limit memory per user

Is it possible to limit memory usage per user not per group? This is my config ... /etc/cgconfig.conf mount { cpu = /cgroup/cpu_and_mem; cpuacct = /cgroup/cpu_and_mem; memory = /cgroup/cpu_and_mem; } group small { cpu { …
Abc Xyz
  • 608
  • 1
  • 8
  • 17
2
votes
1 answer

Understanding OOM killer logs

I run some processes inside docker container and I use memory limitation for this container. Sometimes some processes inside docker container got killed by OOM killer. I see that in syslog file: beam.smp invoked oom-killer: gfp_mask=0xd0, order=0,…
sergeyz
  • 223
  • 1
  • 3
  • 8