Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cgroups]

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

0
votes
1answer
12 views

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

libvirt will not start VMs with “error: Invalid value '+cpu' for 'cgroup.subtree_control': Invalid argument”

On one workstation I have, libvirt has stopped working; it'll no longer start VMs: $ virsh --connect qemu:///system 'start westerley-pool' error: Failed to start domain westerley-pool error: Invalid ...
0
votes
0answers
4 views

configuring a process to control memory allocations

cgroup has various configuration setting to restrict the memory usage. memory.memsw.limit_in_bytes memory+swap memory.limit_in_bytes memory But, even though I add PID of a process in ...
2
votes
0answers
51 views

Why would a process limited to a portion of one cpu run slower when the Cpu is partially idle?

A task must receive the same resource allocation, and no more, regardless of whether the rest of the system is idle. The aim is to achieve a predictable time to complete the task irrespective of other ...
1
vote
0answers
19 views

cgroup IO control v.s. (the new types of) Linux AIO

In Linux v5.0, do some types of Asynchronous IO bypass the cgroup IO controllers? EDIT: buffered write() and fsync() might be relatively complex to analyse. I found an interesting post about ...
0
votes
0answers
9 views

Getting info about particular cgroup

my process is attached to a cgroup /user.slice/lim.scope. How to know how does that cgroup limits my process?
1
vote
0answers
37 views

Limit container resources both using --memory and --cgroup-parent

I'd like to limit both total memory consumption for a group of containers as well as memory consumption for a particular container. Say, a container is allowed to consume not greater than 1Gb and all ...
1
vote
0answers
16 views

Setting a timeout and limiting memory of a process

I'm trying to run a large process on my machine with a timeout and maximum memory limit. For handling the memory usage, I created a cgroup and use this shell script to start the process: #!/usr/bin/...
0
votes
1answer
23 views

Does enabling one of the `Accounting=` options in a systemd unit, cause it to be enabled for *all* units?

CPUAccounting= Turn on CPU usage accounting for this unit. Takes a boolean argument. Note that turning on CPU accounting for one unit will also implicitly turn it on for ...
0
votes
0answers
16 views

Linux cgroup memory is not beeing freed

I have an k8s cluster and one of the pods is crashing because of OOM. It has the limit of 400MB but crashing when pod reaches 30MB and I have no idea why. There is no other process in its cgroup but ...
1
vote
1answer
20 views

cgroups (V1) does not work — how to diagnose/debug?

I set up cgroups on a shared system to limit the cpu access to a group to 25% but it does not seem to be working. Here are the steps followed: Add this line to /etc/cgrules.conf: @guest_users cpu ...
3
votes
1answer
52 views

How to have memory/cpu limits only for forked children and not for the parent process?

Is there a way to have limits for (let's say) apache2, that limits each forked child worker process to use max X memory, and not the entire process tree (apache2 and all of its forked children) to max ...
1
vote
0answers
43 views

What is the importance of cgconfig.conf?

I am currently trying to get a deeper grasp into cgroups. I am working with Ubuntu 18.04 and installed the necessary libraries. I am following the documentation from this site: https://access.redhat....
-1
votes
1answer
39 views

Does chroot need any special kernel support?

docker is said to be a steroid version of chroot. Does chroot need any special kernel support, e.g. namespace, cgroup? Does docker rely on chroot? I ask this because "Docker is not virtualisation: ...
-1
votes
1answer
45 views

Is a cgroup a list of key value pairs or a set of processes?

I get the idea that a cgroup is a set of processes satisfying some conditions, from http://man7.org/linux/man-pages/man7/cgroups.7.html A cgroup is a collection of processes that are bound to a set ...
-3
votes
1answer
71 views

What is a docker container from Linux's point of view? [closed]

A docker container is a concept understood by docker daemon. What is a docker container from Linux's point of view? You can stop, kill and destroy a container. Is a container itself a process? Is a ...
0
votes
0answers
26 views

How to create a memory limit group for systemd services with internal shutdown of this services according to demand?

I want to do something like that: I have 3 services (A, B and C). I want to join them in something like a .slice file, and set a memory limit for it. But when one of this services need more memory it ...
1
vote
0answers
26 views

How can I enable asynchronous swapping using a kswapd thread in a cgroup resolution?

I would like to enable active swapping (using a background daemon) on my cgroup even before the entire system is suffering memory shortage. I have a 128GB Linux host and a cgroup that is limited to ...
2
votes
0answers
67 views

How are cpu.cfs_ period_us defined in cgroups and kernel.sched_cfs_bandwidth_slice_us related?

I've been trying to understand how the Completely Fair Scheduler in the Linux kernel does CPU bandwidth control. After many readings, I still cannot understand how the CFS allows for each cgroup to ...
1
vote
1answer
72 views

How do I read the systemd MemoryHigh value from the /sys/fs/cgroup filesystem?

I have a systemd service that sets MemoryHigh and MemoryMax. If I look under its cgroup in /sys/fs/cgroup/memory the memory.limit_in_bytes file matches the limit set by MemoryMax, but where do I find ...
1
vote
1answer
70 views

Granting cpusets permissions to non-root user

By default, only root can create CPU sets (and manipulate tasks in existing ones): $ cset shield -c0 cset: **> [Errno 13] Permission denied: '/cpusets//user' cset: insufficient permissions, you ...
0
votes
0answers
29 views

Using Cgroup inside network namespace?

I have a dedicated machine with multiple host interfaces [eth0 for host network] and (eth1, eth2, eth3) additional, 3-static available IPs. I want to create 3 network namespaces for each of these ...
2
votes
1answer
704 views

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. ...
1
vote
0answers
167 views

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 ...
1
vote
1answer
719 views

Systemd under Ubuntu 18.04.1 fails with “Failed to create /user.slice/…service/init.scope control group: Permission denied”

On my Ubuntu 18.04.1 system the User Manager of systemd fails to start. I suppose this to be the root cause of other problems that I currently encounter. Any ideas how to get rid of this? systemd ...
1
vote
0answers
71 views

How do you use cgroups from within a network namespace

I just discovered that mount | grep cgroup returns nothing when you are not in the default network namespace. I can't really find any documentation on this except for that "network namespaces isolate ...
0
votes
0answers
23 views

limit cpu and memory consumption of all X applications

I want to reserve a small amount of cpu and memory to be able in case of emergency create tty session and kill a memory hogging X application. cgroups provide this functionality. How do I put all my X ...
1
vote
1answer
629 views

Booting with `cgroup: cgroup2: unknown option “nsdelegate”` prevents any graphics from appearing

I recently updated my Linux 4.9.0-8 debian 6.3.0. However, when I restarted my machine, ended up having the message in the title. Preventing me from accessing the graphical terminal. I can't access my ...
1
vote
1answer
51 views

What are the benefits of using longer/shorter periods in cpu.cfs_period_us?

When you want to limit CPU time per process, you can do it via cgroups. There are two parameters that can do the job: cpu.cfs_period_us and cpu.cfs_quota_us. There's some info on the parameters here: ...
0
votes
0answers
111 views

Cannot start lxc container as non-root user

When I try to start a container it fails: # lxc-start -n mycont4 --logpriority debug --logfile /tmp/basta.log -F lxc-start: cgroups/cgfs.c: lxc_cgroupfs_create: 909 Could not set clone_children to 1 ...
0
votes
1answer
123 views

Why can't a fork bomb be killed in zsh in the same way as it's killed in bash?

I wanted to make my system a little bit more resilient to fork bombs. This can be partially achieved by using systemd's DefaultTasksMax parameter, or by using cgroup's pids controler for all valid ...
5
votes
1answer
119 views

How to find out if systemd uses legacy, hybrid or unified mode (cgroupsv1 vs cgroupsv2)?

Systemd can use one of three modes in regard to how it manages cgroups: legacy hybrid unified How can I check which one is it using?
0
votes
1answer
135 views

How to Keep Network Namespace after reboot

I have created a network namespace, but after I have reboot, it've been removed. I don't found an answer at this problem on the internet, so this is why I'm asking you : Is there a way to keep a ...
2
votes
2answers
1k views

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 ...
0
votes
1answer
268 views

cgroups: Is it possible to limit cpu usage by process name instead of by pid

As we know, cgroups can limit cpu usage of processes. Here is an example: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 30142 root 20 0 104m 2520 1024 R 99.7 ...
5
votes
3answers
934 views

What's “broken” about cpuset cgroup inheritance semantics in the Linux kernel?

To quote the 2013 systemd announcement of the new control group interface (with emphasis added): Note that the number of cgroup attributes currently exposed as unit properties is limited. This will ...
2
votes
1answer
334 views

systemd memory limit user instance not working

I'm using Arch Linux and systemd version is 239. I booted system with systemd.unified_cgroup_hierarchy=1 kernel parameter. I made two unit files, limit.slice and malloc.service. limit.slice is [...
1
vote
0answers
218 views

RVM not detected in multi-user installation

I have two ubuntu users deploy and developers I install rvm using Multi-User: curl -L https://get.rvm.io | sudo bash -s stable by default this one will create rvm group. The rvm will be installed ...
2
votes
1answer
57 views

Are containers transparent to POSIX parent-child process relationships?

Imagine a hypothetical shell that launches all commands in ad-hoc containers with some isolation and resource controls depending on function of each command: cat foo.txt | sed ... | xargs some-...
1
vote
1answer
306 views

CPU usage limit to systemd-nspawn container is not working

I am using systemd-nspawn(systemd version 237) in Yocto's embedded Linux environment. This is the content of /etc/systemd/system/systemd-nspawn\@.service.d/override.conf file ExecStart=/usr/bin/...
3
votes
0answers
1k views

How to use cgroup limit in systemd user slices? [closed]

I have a CentOS 7.4 system which has a number of users who access the system via SSH. I need a way to prevent them from consuming all CPU and memory of the system. For example, each user getting 1 ...
4
votes
1answer
419 views

What's the Linux kernel's behaviour when processes in a cgroup hit their memory limit?

The memory resource controller for cgroups v1 allows for setting limits on memory usage on a particular cgroup using the memory.limit_in_bytes file. What is the Linux kernel's behavior when this limit ...
4
votes
3answers
583 views

Limit memory for browser on Fedora

I would like to limit memory usage for Chromium (/bin/chromium-browser) and Firefox (/bin/firefox) for all users. Before moving to Fedora I was using cgroups for that. However, I heard that on Fedora ...
0
votes
2answers
686 views

Cgroup memory.usage_in_bytes shows incorrect value

I created a Cgroup on my Linux device and noticed that the value of memory.usage_in_bytes (4325376) is bigger than the sum of RSS, CACHE and SWAP (4194304). I read in a reliable documentation, the ...
0
votes
1answer
1k views

Calculating CPU usage of a cgroup over a period of time

If I have a cgroup like user.slice and have CPUAccounting=true set up, I'm wondering how one would calculate the CPU Usage of that particular cgroup over a period of time (such as 1s), using either ...
0
votes
1answer
154 views

Why is machine.slice shown as using memory, when it does not contain any processes?

$ systemctl status machine.slice ● machine.slice - Virtual Machine and Container Slice Loaded: loaded (/usr/lib/systemd/system/machine.slice; static; vendor preset: disabled) Active: active ...
0
votes
1answer
354 views

Limiting RAM for a group of users on Ubuntu Machine

I have a gpu based system. Multiple users use the system, as a result, the RAM frequently gets fully utilized leaving no memory for myself. I want to put a maximum RAM limit on all the users except ...
1
vote
0answers
71 views

CGroup perm for every user in gid

i need every user in group users can work with the following cgroup 'shol'. Here is my cgconfig.conf, if i use the code i can't run with my users in group users gexec. group shol { perm { ...
0
votes
0answers
261 views

CGroup Debian 9 (4.9.82) won't work

i want to use cgroup to manage memory of specific processes. I install cgroup-tools, enabled the memory controller in /etc/default/grub with GRUB_CMDLINE_LINUX_DEFAULT="quiet cgroup_enable=memory ...
2
votes
1answer
332 views

Is my cgroup overloaded?

Suppose I limited the cores a set of processes is permitted to use with cgroup/cpuset option. I need to know if I have too many threads allocated to that cgroup, if the threads are experiencing ...