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

learn more… | top users | synonyms

13
votes
2answers
2k views

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 ...
12
votes
1answer
7k views

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 ...
12
votes
1answer
465 views

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 ...
11
votes
2answers
440 views

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 ...
10
votes
1answer
2k views

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?
10
votes
2answers
1k views

How to solve this memory issue gracefully?

I have a standard Linux (Debian testing) laptop, with a swap partition. I do a lot of experiments with it. Some of them are really memory hungry and the way Linux behaves by default is an issue for ...
9
votes
2answers
2k views

Use cgroup to limit the memory usage of virtualbox

I am trying to use cgroup (Control Group) to limit the memory usage of virtualbox, but it does not seem to work. My machine is: $ uname -a Linux fc.bgi 2.6.40-4.fc15.i686 #1 SMP Fri Jul 29 18:54:39 ...
9
votes
0answers
79 views

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 ...
9
votes
0answers
521 views

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 ...
8
votes
1answer
208 views

Do processes in cgroups have to be set every boot? If so, how to persist them?

I was reading this answer to a question on setting limits for processes by using cgroups. The sample given sets limits for a process (in the example, sshd). In the answer, the PID of the process is ...
7
votes
1answer
822 views

Why are cgroups mapped differently on these two systems by systemd

I have two systems, both running customized variants of OpenSuSE 12.2 (Mantis), both running exactly the same kernel. I get two very different outputs of /proc/self/cgroup or /proc/$$/cgroup on the ...
7
votes
1answer
136 views

reserve resources for admin console

My server is often almost DOS'ed by crawlers. I have not yet managed to figure out what exactly is responsible for the high load. CPU, memory and disk IO are not at the limit (could be network ...
7
votes
2answers
156 views

Does managing cgroups require root access?

I am trying to work with control groups on two different operating systems (Ubuntu and CentoOS). There are few concerns that I would like to ask. I am trying to create a control group using the ...
6
votes
3answers
4k views

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 ...
6
votes
1answer
275 views

Executing a “fork bomb” safely

We've all seen the "fork bomb" that will render a host non-responsive, even if executed in an unprivileged shell: Warning: Do not execute the following shell script. Just don't. :(){ :|:& };: ...
6
votes
3answers
446 views

Externaly limiting number of CPU cores used

I need to externally limit a process/session to a certain number of cores. Are there any other possibilities than CPU affinity (I don't like the need to specify the actual cores) and cgroups (hard to ...
6
votes
3answers
611 views

How to jail a fastcgi server (or a web-proxied server)?

If you have a web-server (e.g. nginx) often you use a fast-cgi server or another application-http-server for dynamic content. That means in both cases you have a nice process separation between the ...
6
votes
1answer
294 views

Can you throttle the bandwidth to a tmpfs based ramdisk?

I created a ramdisk using tmpfs as follows: sudo mount -t tmpfs -o size=1024m tmpfs /myramdisk I was looking into cgroup blkio subsystem bandwidth limits "read_bps_device" and "write_bps_device" ...
5
votes
0answers
601 views

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 ...
4
votes
2answers
152 views

Reference documentation for cgroups (control groups) settings

I'm looking for some reference documentation to explain what each of the settings are, for each control group. For example, there's cpuset.cpus, I think setting this to 0 means use all CPUs, setting ...
4
votes
1answer
2k views

controlling priority of applications using cgroups

I would like to understand cgroups better and would like to understand the use-cases for applying cgroups. Are cgroups a good way for prioritizing different applications (i.e, giving higher priority ...
4
votes
1answer
270 views

Permanent swapping with lots of free memory

We have a Linux server running Debian 4.0.5 (Kernel 4.0.0-2) with 32G RAM installed and 16G Swap configured. The system uses lxc containers for compartmentalisation, but that shouldn't matter here. ...
4
votes
1answer
1k views

How can I configure fair bandwidth sharing between cgroups?

It's fairly easy to use tc with Stochastic Fairness Queueing (SFQ) to configure fair bandwidth sharing between flows, but an application can open multiple flows and get an unfair share of bandwidth. ...
4
votes
1answer
147 views

Using tc for traffic quotas?

Is it possible to implement traffic quotas (absolute limits, not rate limits) based on the network classifier cgroup? I see there is the iptables netfilter 'quota' extension, which seems to do ...
4
votes
0answers
76 views

Get quota usage information as non-privileged user

I have non-privileged access to a Linux server (shared PHP+MySQL hosting) and there are disk space, memory, CPU usage, I/O quotas. I wonder how can I get information about max/current quota usage ...
4
votes
0answers
388 views

What does hierarchy support do in cgroup?

cgroup has 2 options for memory control: memory.use_hierarchy = 1 : use hierarchy memory.use_hierarchy = 0 : use flat hierarchy, according to this answer What is the difference between the two? I ...
3
votes
3answers
344 views

Creating one-time cgroup

I would like to be able to create a one-time temporary group in hierarchy. For example: #!/bin/sh run_with_csubgroup /sys/fs/cgroup/group/subgroup/ Which creates group say ...
3
votes
2answers
2k views

cgroups: blkio.weight doesn't seem to have the expected effect

I've got 2 LXC containers with these cgroup settings: lxc.cgroup.blkio.weight = 200 lxc.cgroup.cpu.shares = 200 and lxc.cgroup.blkio.weight = 800 lxc.cgroup.cpu.shares = 800 I have verified in ...
3
votes
1answer
48 views

Cgroups Memory Related Questions

1) Why cgroup is showing more number of tasks than actual number of tasks.? Ex : [root@localhost proc]# ps -aux | wc -l 421 [root@localhost proc]# cat /sys/fs/cgroup/memory/tasks | wc -l 539 2) ...
3
votes
1answer
4k views

USB passthrough for LXC containers

PROBLEM: So I've been trying to get a usb device (primesense - the OEM reference for the Kinect) to passthrough to an LXC container so I can develop without worrying about polluting my stable system ...
3
votes
1answer
102 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 ...
3
votes
2answers
374 views

Monitor when read/write on metadata or mmaped files hit the disk

On a server hosting a wide range of websites, I often see IO becoming a bottleneck without being able to identify the processes responsible of IO operations with tools such as iotop, iostat or sar. I ...
3
votes
0answers
82 views

Sandboxing a binary on linux

I am trying to understand various options I have to restrict/sandbox a binary in Linux. I see that I can use namespaces and cgroups like docker does. I could use SELinux like this link suggests. Which ...
3
votes
1answer
483 views

Linux cgroups: limit CPU usage in absolute values which do not depend on CPU speed

I have a server with a 2.4GHz processor. And there are several cgroups, each one allowed to use 25% of CPU. That's equal to 600MHz. Then I replace the CPU with a faster one, let's say 3.0GHz. If I ...
3
votes
1answer
472 views

What priorities can be used in cgroups net_prio module?

Cgroups has a module called net_prio, and by using this module I can set the priority of network traffic generated by various applications. As you can read here, this can be achieved by setting ...
3
votes
0answers
737 views

cpu time measurement with wait4 vs. cpuacct cgroup

I want to start a process and measure the cpu time (user+sys) it needs until it terminates. I know I can use the wait4 system call, which returns a struct with user and system time (I use the sum of ...
3
votes
2answers
519 views

Measuring CPU and Memory per user to distribute “cost” of a server [closed]

How should I implement approximately correct per-user monitoring on a server? I want a way to split the cost of a server between the users based on their usage. On newer machines (RHEL6) I would use ...
2
votes
1answer
147 views

cgroups analogue in Darwin

Is there an analogue to cgroups in Darwin for preventing processes from escaping from the control / monitoring of its parent process by means of fork()? If yes, what is it? For some background, ...
2
votes
0answers
64 views

cgroups: cgclassify processes of other users

As root I've create a cgroup which limits cpu and memory usage. cgcreate -g cpu,memory:matlab_sandbox cgset -r cpu.shares=250 matlab_sandbox cgset -r memory.limit_in_bytes=8G matlab_sandbox Now I'm ...
2
votes
0answers
54 views

What is “state-object” in cgroups

I am gathering some idea about lxc, kernel name spaces and cgroups. While reading man lxc-cgroup, i find : lxc-cgroup gets or sets the value of a state-object (e.g., 'cpuset.cpus') in the ...
2
votes
0answers
182 views

Limit system processes using cgroups

My server runs several dozens of processes that are not in my control (mostly monitoring software). According to my application logs, sometimes some of the third party processes try to allocate too ...
2
votes
2answers
451 views

Need help finding the CPU id numbers to use with cpu sets

The man for cpuset doesn't seem to clearly list how to figure out which numbers map to which processing units. My current machine has two Intel Xeon E5645s, each of which has 6 cores and ...
2
votes
1answer
184 views

How to calculate blkio shares in cgroups?

Currently I'm trying to setup a test scenario with the use of Debian Wheezy with its default kernel 3.2.60-1+deb7u3 and the cgroups blkio controller. The calculation of blkio.weight is not working for ...
2
votes
0answers
113 views

Cgroups - memory subsystem

I want to set the memory.limit_in_bytes parameter for a control group and disable OOM, so processes freeze when the limit is reached. But i want to change that limit dynamically, if there is more ...
2
votes
0answers
152 views

CGroup Processes Not Terminated even when main process has been killed through Systemctl stop command

I am running systemctl stop process command for some process. Please find the output for systemctl status process below: Loaded: loaded Active: deactivating (stop-sigterm) CGroup: ...
1
vote
1answer
186 views

What are the “cpu” and “memory” options on the mount command?

I found some mount commands in a shell script: mount -t cgroup -o memory none /path/XXX mount -t cgroup -o cpu none /path/XXX The question is what does the cpu/memory option mean? I search the ...
1
vote
1answer
38 views

mkdir under /cgroup creates files along with directories

All this while I have been thinking that mkdir can only create directories. But I am surprised to see that it was able to create files also under some conditions. I recently started working with ...
1
vote
1answer
47 views

cgconfig.conf file is missing

I installed cgroup on my linux (3.19.0+) using the following command: apt-get install cgroup-bin However I can't find the file /etc/cgconfig.conf. Did I miss anything?
1
vote
1answer
20 views

Configure scheduling to a program

The program "checking" should be autostart when the machine boot and should be start always with scheduling round robin with priority 27 in Rhel/Centos 7. I can configure this scheduling with cgroups ...
1
vote
1answer
312 views

How to ensure ssh via cgroups on centos?

When some cpu-intensive processes are running on the server, chances are that we could not log in to this machine with error 'operation timeout' via ssh command. According to this post answered by ...