Skip to main content

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.

Filter by
Sorted by
Tagged with
33 votes
3 answers
58k views

How to find out cgroup of a particular process?

Is there any method to get cgroup of process? The only one package that I know (cgroup-bin), just provide some manipulations with cgroups and allow to change cgroup of process/list of processes, but ...
zerospiel's user avatar
  • 467
27 votes
4 answers
19k views

How can I create and use Linux cgroups as a non-root user?

How can I create and use cgroups as a non-root user? For example, can I, entirely as a non-root user: create a cgroup with access to one CPU create a new process in that cgroup ? I first asked ...
Adam Monsen's user avatar
26 votes
2 answers
57k views

loop device in a Linux container?

I'm attempting to use a loop device inside a container, to mount some image file: > sudo losetup /dev/loop0 test.img losetup: /dev/loop0: failed to set up loop device: No such file or directory /...
Johannes Ernst's user avatar
25 votes
7 answers
46k views

Systemd fails to run in a docker container when using cgroupv2 (--cgroupns=private)

I will attach the minimized test case below. However, it is a simple Dockerfile that has these lines: VOLUME ["/sys/fs/cgroup"] CMD ["/lib/systemd/systemd"] It is Debian:buster-...
Stephen's user avatar
  • 365
14 votes
1 answer
8k views

How does CPU affinity interact with cgroups in Linux?

I'm trying to run multi-threaded benchmarks on a set of isolated CPUs. To cut a long story short, I initially tried with isolcpus and taskset, but hit problems. Now I'm playing with cgroups/csets. I ...
Edd Barrett's user avatar
10 votes
1 answer
9k views

Cgroup - no space left on device

I have Debian 7 box and little issue: mkdir /cgroups/test echo 500 > /cgroups/test/cpu.shares echo 3167 > /cgroups/test/tasks bash: echo: write error: No space left on device How can I fix it? ...
Guest's user avatar
  • 103
10 votes
3 answers
7k views

Why are applications in a memory-limited LXC container writing large files to disk being killed by the OOM?

EDIT2: This problem appears to exist as well under 3.8.0-25-generic #37-Ubuntu SMP EDIT: I modified the question from the original title of "Why would the Linux Out of Memory manager be triggered by ...
UsAaR33's user avatar
  • 1,166
9 votes
2 answers
16k views

How do I set cgroup limits for systemd user slices?

I would like to limit usage of a system on a per user basis. Since Systemd has native support for cgroups, I think using user slices is the way to go. The problem is: I can't figure out how to set ...
Steve F's user avatar
  • 371
8 votes
1 answer
15k views

The memory usage reported in cgroup differs from the free command

Why would the free command be reporting a much different mem usage number vs cgroup? $ free -b total used free shared buff/cache available Mem: 2096914432 ...
offbynull's user avatar
  • 243
7 votes
1 answer
6k views

List of controllers empty with cgroup v2

I am trying to learn how cgroups v2 work. I did this: mount -t cgroup2 none /mnt/cgroup2 That gave me a list of objects in /mnt/cgroup2 root@ubuntu-s-1vcpu-1gb-lon1-01:~# ls -la /mnt/cgroup2/ total ...
ACC's user avatar
  • 249
7 votes
1 answer
2k views

Why are cgroups (blkio serviced bytes) and iotop producing diverging results

I work with lxc user space tools on ubuntu 14.04 and I want to perform some stress tests and benchmarking within a container. I know that free and htop are not working properly in a container. I am ...
Tropp Meaison's user avatar
7 votes
2 answers
5k views

Why do user and system cpu in cpuacct.stat not add up to cpuacct.usage?

Question relates to Linux cgroups cpu accounting. I noticed this at the container level, but it persists up to top level. For instance: # cat /sys/fs/cgroup/cpu/cpuacct.stat /sys/fs/cgroup/cpu/...
Bryan's user avatar
  • 354
7 votes
1 answer
3k views

htop cgroup column widen

How can I see full length of text CGROUP column in htop? I cannot enlarge it.
plaidshirt's user avatar
7 votes
2 answers
3k views

How to do network accounting using cgroups

I am trying to get network statistics for groups of processes. As far as I know, complex network accounting on linux is normally done using the accounting infrastructure of netfilter/iptables. As I'd ...
t-8ch's user avatar
  • 71
7 votes
1 answer
2k views

Where is my container's memory going?

I have a container leaking memory. Or at least, reported memory consumption goes up fast. If I run top, I get this: top - 16:56:51 up 6 days, 17:25, 0 users, load average: 0.16, 0.27, 0.31 Tasks: ...
ledneb's user avatar
  • 189
7 votes
0 answers
2k views

Applying systemd control group resource limits automatically to specific user applications in a gnome-shell session

Having seen that GNOME now launches apps under systemd scopes I've been looking at a way to get systemd to apply some cgroup resource and memory limits to my browser. I want to apply a MemoryMax and ...
Craig Ringer's user avatar
  • 11.3k
6 votes
0 answers
2k views

How to view cgroups resource control heritage between parents and childs process

Taking for example this hierarchy from systemd-cgls: └─user.slice ├─user-1000.slice │ ├─[email protected] │ │ └─init.scope │ │ ├─3262 /lib/systemd/systemd --user │ │ └─3263 (sd-pam) ...
rfmoz's user avatar
  • 802
5 votes
3 answers
24k views

What is required to activate cgroups in Linux

I have a Debian squeeze kernel (linux-image-2.6.32-5-openvz-amd64) which according to the Doku should support cgroups. When I look into the kernel configuration, it does (or is some other kernel ...
divB's user avatar
  • 570
5 votes
2 answers
4k views

route traffic from a cgroup via a specific network interface

Is there a possiblity, to restrict a cgroup to a specific network interface? All packets from the cgroup should only be routed via a VPN connection, while other packets use the default route. With ...
allo's user avatar
  • 1,733
5 votes
2 answers
7k views

cgroup fork rejected by pids controller

Have a small server program written in C/C++ that uses nginx and Postgres, currently all are hosted on the same ubuntu system. I usually run the server program from the bash command line. Recently on ...
myk's user avatar
  • 191
5 votes
3 answers
4k views

How does systemd put sshd processes in slices?

I'm diagnosing an SSH bastion I manage. This machine has about 5500 SSH connections with port forwarding at any given point in time. Recently, I ran into an issue where SSH connections where refused ...
Simon's user avatar
  • 223
5 votes
1 answer
1k views

KVM + cgroups: Dom0 process best practice?

I am transitioning from Xen to KVM, and will be using Fedora 14. I plan to use cgroups to assign priorities to VMs. My question is as follows: If I place VMs in various cgroups, should I also put ...
BigChief's user avatar
  • 398
5 votes
2 answers
2k views

What are the advantages/disadvantages of using cgroups?

I administer several Linux-based servers and we are looking at migrating several JBoss apps as well as a couple of websites running on Apache from a RHEL 5.5 (64-bit) server with 4 cores to a RHEL 6 (...
Brian's user avatar
  • 231
5 votes
0 answers
2k views

Use of cores with `isolcpus` and `cpuset`

I have a Red Hat Enterprise Linux Server release 6.9 (Santiago) (I don't manage it). In the GRUB config file I have, let's say, isolcpus=2-32 (out of 36 cores). I also have a cgroup with cpuset=2-32 ...
Arkadiy's user avatar
  • 208
4 votes
1 answer
4k views

Cannot find network subsystem in cgroup on Ubuntu 12.04 LTS

I'm trying to use cgroups to limit a process's network bandwidth, as described in this answer. However, I am unable to find the "files" they refer to. I am using Ubuntu 12.04 LTS with cgroup-bin ...
user1202136's user avatar
4 votes
2 answers
7k views

Setting the MemoryLimit of a user-created systemd scope using cgroups as user

Related: LImiting overall memory usage for child processes Is there a way for an unprivileged user, or for root to allow an unprivileged user, to create a systemd scope (or other control group ...
Sami Liedes's user avatar
4 votes
1 answer
3k views

How to find which cgroup caused OOM?

I'm using cgroup to partition my processes and I'm getting Out Of Memory messages in my kernel logs. However, I can't find which partition causes them. I've checked the memory controller cgroup but ...
Cyberax's user avatar
  • 269
4 votes
2 answers
5k views

Centos 6 to Centos 7 cgroups

I'm trying to set up resource limits per user in Centos 7, but I can't find the right commands for the new implementation of cgroups (I did read the documentation but it talks about restricting ...
Jesús Carrera's user avatar
4 votes
1 answer
1k views

cgroups memory 16GB ceiling

I am trying to use cgroups to limit memory usage of user processes on servers with a large amount of ram (128 GB or more). What we want to achieve is to reserve about 6GB of ram for OS and root ...
Marc-andré Labonté's user avatar
4 votes
1 answer
4k views

Cannot start cgconfig on Centos 6.5 : cannot mount cpuset to /cgroup/cpuset: Invalid argument

I'd like to try docker-io on Centos 6.5 but the cgconfig daemon will not start: /etc/init.d/cgconfig restart Stopping cgconfig service: [ OK ] Starting cgconfig ...
codecowboy's user avatar
  • 1,367
4 votes
1 answer
2k views

cgroup administration and inheritance

In cgroups there seems to be an option called 'cgroup.clone_children' for each subsystem, that allows you to specify if the setting of the parent cgroup should be inherited into the child cgroups. But ...
elventear's user avatar
  • 223
4 votes
0 answers
838 views

`systemctl show` outputs incorrect MemoryCurrent value

on one box, systemctl show get an incorrect value for unit memory usage: $ systemctl show crond | grep MemoryCurrent MemoryCurrent=18446744073709551615 18446744073709551615 == UINT64_MAX, this must ...
georgexsh's user avatar
  • 143
4 votes
0 answers
717 views

cgexec not inheriting LD_LIBRARY_PATH

My /etc/cgconfig.conf file consists of mount { cpuset = /cgroup/cpuset; cpu = /cgroup/cpu; cpuacct = /cgroup/cpuacct; memory = /cgroup/memory; devices = /...
drjrm3's user avatar
  • 141
4 votes
1 answer
2k views

Linux cgroups cpuset w/ subs causes cgconfig not to start

I am having a problem trying to separate 2 groups using cpuset subsystem. This works fine, however if i go to add a subgroup to that group (in this case -- user1), cgconfig will fail to start with "...
Josh Trier's user avatar
3 votes
2 answers
18k views

Kubernetes cgroup driver misconfiguration

Default Docker installation in CentOS starts with systemd Cgroup. I installed Kubernetes from official YUM repo and systemd drop-in 10-kubeadm.conf has the following contents: [Service] Environment="...
Gasim's user avatar
  • 1,187
3 votes
1 answer
2k views

Is there a way to set the cgroup that systemd launches a process in?

systemd launches a process in the /system.slice/process-name.service cgroup. I would like to launch the process in a different cgroup. I can do this using cgexec in the ExecStart option, but is there ...
Jeff Kubina's user avatar
3 votes
2 answers
2k views

I can't get the cgroup blkio to throttle the iops of processes in a sub-cgroup

I can't get the cgroup blkio to throttle the iops of processes in a sub-cgroup. I am using CentOS 7, 3.10.0-229. I create the cgroup /sys/fs/cgroup/blkio/user.slice/test1 and do echo 8:32 10 > /...
Jeff Kubina's user avatar
3 votes
1 answer
4k views

CGroups memory limit not working

I am trying to limit memory usage for a LXC container using CGroups, but I can't limit the memory. # lxc-cgroup -n maxdaniel981 memory.limit_in_bytes 134217728 lxc_container: failed to assign '...
maxdaniel98's user avatar
3 votes
1 answer
6k views

systemd: how do I create a new .slice file?

I'm struggling to understand how to set up a new slice on my debian 10 system. I have created a file, system-db.slice by copying system.slice and changing a couple of things: # This file is part of ...
j4nd3r53n's user avatar
  • 246
3 votes
1 answer
4k views

Freeze and unfreeze processes transparently?

I'm looking for a way to transparently freeze (pause) a process and then unfreeze it later. This is possible with SIGSTOP, but SIGSTOP causes the parent to be notified (by returning from waitpid), ...
Brendan Dolan-Gavitt's user avatar
3 votes
1 answer
2k views

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's user avatar
  • 325
3 votes
1 answer
3k views

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/...
Zabuzzman's user avatar
  • 733
3 votes
1 answer
3k views

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's user avatar
  • 2,399
3 votes
1 answer
1k views

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 (...
Rooster's user avatar
  • 515
3 votes
1 answer
1k views

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 ...
Vladimir Panteleev's user avatar
3 votes
1 answer
1k views

How to use cgroup v2 to limit memory and cpu per user group?

With cgroup v1, I can have group configuration in cgconfig.conf and assign groups to different users in cgrules.conf However, it seems to me that cgconfig and cgrules can't be used along with cgroup ...
Lei Yu's user avatar
  • 131
3 votes
1 answer
402 views

Why LXC requires restart?

LXC documentation says: Just before you create your first container, you probably should logout and login again, or even reboot your machine to make sure that your user is placed in the right ...
Jacek L.'s user avatar
  • 131
3 votes
1 answer
1k views

Centos 7 & Hard CPU Limits

OS Version Information: [root@localhost system]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) Configuration for the test.slice is as follows: [root@localhost system]# cat test....
sydraz's user avatar
  • 131
3 votes
1 answer
880 views

Restrict I/O Write usage using cgroups

I am trying to restrict I/O write usage on my server using cgroups. Here is my partition table info: major minor #blocks name 8 0 10485760 sda 8 1 9437184 sda1 8 ...
Divij Satra's user avatar
3 votes
2 answers
3k views

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, ...
Henk's user avatar
  • 59