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....
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 ...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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.
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
./...
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 ...
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"
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 ...
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 ...
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 /...
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 ...
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....
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 ...
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 ...
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/...
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, ...
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.
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
cgroup × 118linux × 54
systemd × 30
docker × 14
centos7 × 10
lxc × 10
memory-usage × 9
debian × 7
kvm-virtualization × 7
centos × 6
linux-kernel × 5
iptables × 4
kernel × 4
pam × 4
ubuntu × 3
ssh × 3
linux-networking × 3
memory × 3
kubernetes × 3
libvirt × 3
io × 3
containers × 3
resource-management × 3
networking × 2
virtualization × 2