Hot answers tagged

26 votes

How to find out cgroup of a particular process?

Using systemd (PID 3378 for example): # systemctl status 3378 | grep CGroup CGroup: /user.slice/user-1000.slice/session-3.scope Using proc: # cat /proc/3378/cgroup 10:memory:/user.slice/user-1000....
user avatar
  • 644
23 votes

loop device in a Linux container?

If you're using systemd-nspawn, start up your container with the --capability=CAP_MKNOD command line switch. This will allow you to create device nodes inside your container. Then create a loop device ...
user avatar
17 votes
Accepted

Cgroup - no space left on device

I have been able to reproduce and solve the issue doing : /bin/echo 0 >/cgroups/test/cpuset.mems /bin/echo 0 >/cgroups/test/cpuset.cpus Seems that CPUs and Memory Nodes' list for the cpuset ...
user avatar
  • 12.7k
15 votes

loop device in a Linux container?

Loop devices are provided by a kernel module. Therefore, you need special privileges to access them. You also need them to be exposed into your container, or you need to manually create the device ...
user avatar
  • 14k
10 votes

Understanding OOM killer logs

The OOM killer decided to kill another process. The message did state: Kill process 20911 .... or sacrifice child It decided to kill the child with pid 20977, a shell script that was spawned by the ...
user avatar
8 votes

How to find out cgroup of a particular process?

The quickest way to view cgroup of a process is by process name, using this bash script: #!/bin/bash THISPID=`ps -eo pid,comm | grep $1 | awk '{print $1}'` cat /proc/$THISPID/cgroup
user avatar
8 votes

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

The very, very bottom of the kernel documentation on blkio controller includes the note: What works Currently only sync IO queues are support. All the buffered writes are still system ...
user avatar
  • 471
8 votes

How does CPU affinity interact with cgroups in Linux?

From the cpusets documentation: Calls to sched_setaffinity are filtered to just those CPUs allowed in that task's cpuset. This implies that CPU affinity masks are intersected with the cpus in ...
user avatar
8 votes

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

tl;dr It seems to me that this use case is not explicitly supported yet. You can almost get it working but not quite. The root cause When systemd sees a unified cgroupfs at /sys/fs/cgroup it assumes ...
user avatar
  • 189
7 votes

How to find out cgroup of a particular process?

From RHEL7 and up, and on some other distro's, I find this util helpful: $ systemd-cgtop Before using it, make sure you have DefaultCPUAccounting=yes in /etc/systemd/system.conf. I even made some ...
user avatar
7 votes
Accepted

List of controllers empty with cgroup v2

cgroup controllers can only be mounted in one hierarchy (v1 or v2). If you have a controller mounted on a legacy v1 hierarchy, then it won't show up in the cgroup2 hiearchy. This limitation is ...
user avatar
  • 6,021
6 votes

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

It seems to work if done this way: $ systemd-run --scope --user --unit limit-test.scope -p MemoryAccounting=yes -p MemoryLimit='10M' bash and then checking the status: $ systemctl show --user limit-...
user avatar
6 votes

Kubernetes cgroup driver misconfiguration

I had the same problems. You need to ensure that Docker and Kubelet run with same cgroup driver. In Centos Docker runs in cgroupfs while kubelet runs in systemd cgroup. In order to change this you ...
user avatar
  • 61
5 votes
Accepted

htop cgroup column widen

Seems a duplicate of this: https://stackoverflow.com/questions/33269339/htop-process-viewer-set-column-width In short, in current versions the column width is fixed. You can ask for this enhancement ...
user avatar
  • 2,227
5 votes
Accepted

Centos 6 to Centos 7 cgroups

Please try for example systemctl set-property user-1000.slice CPUShares=100 Assuming you wish to limit the resource for UID 1000 and limit the CPUShares.
user avatar
4 votes
Accepted

route traffic from a cgroup via a specific network interface

iptables support for -m cgroup has not yet been released, but you can easily build the extension yourself and install it on your system: git clone git://git.netfilter.org/iptables.git cd iptables ./...
user avatar
4 votes
Accepted

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

Ok, so the correct answer is that you cannot setup cgroup limits for user processes (at the time of writing this answer, anyway). Ref from systemd-devel mailing list: We simply do not support this ...
user avatar
4 votes
Accepted

CGroups memory limit not working

There's a small typo in your GRUB configuration; cgroup not cggroup should do the trick: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1"
user avatar
  • 613
4 votes
Accepted

High on %wa from top command, is there any way to constrain it?

You don't have enough RAM to run these 2000 processes. We can see here that you have used all of your 64GB of RAM, and are also using an additional 17GB of swap. Your server is thrashing, trying to ...
user avatar
4 votes
Accepted

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

Creat a group-name.slice, and set the resource control configuration in the slice unit, such as, CPUShares=, MemoryLimit=. Then set Slice=group-name.slice in the process-name.service. See man ...
user avatar
4 votes
Accepted

The memory usage reported in cgroup differs from the free command

memory.usage_in_bytes and memory.max_usage_in_bytes report RSS+CACHE, so in terms of your free output: memory.usage_in_bytes ~= free.used + free.(buff/cache) - (buff) You may also be interested in /...
user avatar
4 votes

Page cache usage listed in cgroup's memory.stat file

This is discussed in section 2.3 of https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt... 2.3 Shared Page Accounting Shared pages are accounted on the basis of the first touch ...
user avatar
  • 203
3 votes
Accepted

Cgroups, limit memory per user

Is it possible to limit memory usage per user not per group? It is possible with templates Rules specified in /etc/cgrules.conf can be linked to templates configured either in the /etc/cgconfig....
user avatar
  • 588
3 votes

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

The Centos 6.5 server is a Virtualized server running Virtuozzo (A Media Temple DV). It seems there would need to be some changes in the Virtuozzo provisioning of the server which the hosting company ...
user avatar
  • 1,267
3 votes

Cgroups with libvirt/kvm on Centos 6.5

Configuration is little different from Ubuntu. You need to add CGROUP_DAEMON=sets:name in /etc/sysconfig/libvirtd. in your case it is CGROUP_DAEMON=memory:/mynamekvm Restart all relavant services ...
user avatar
  • 1,470
3 votes

What is required to activate cgroups in Linux

It depends on your distribution and kernel version. You can use following script from Docker to test cgroups and container related features: wget https://raw.githubusercontent.com/docker/docker/...
user avatar
  • 1,915
3 votes

What is required to activate cgroups in Linux

You should mount like that[1]: $ mount -t cgroup -o <cgroup_subsystem> name /cgroup/name cgroup_subsystem can be[2]: {blkio, cpu, cpuacct, cpuset, devices, freezer, memory, net_cls, net_prio, ...
user avatar
  • 141
3 votes
Accepted

Can't enable cgroups memory controller

It turned out that with a new version (8.5) of Debian DigitalOcean add a file to /etc/default/grub.d/ where GRUB_CMDLINE_LINUX_DEFAULT was redefined.
user avatar
  • 223
3 votes
Accepted

Freeze and unfreeze processes transparently?

I was able to freeze and thaw a single process (xeyes) rather easily using these directions: https://www.kernel.org/doc/Documentation/cgroup-v1/freezer-subsystem.txt I know it's the same document ...
user avatar
3 votes

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

I'm not a kernel developer, but, digging through the kernel source code, cpuacct.usage (updated via cgroup_account_cputime) and cpuacct.stat (updated via cgroup_account_cputime_field seem to be ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible