process,linux-kernel,cgroups,linux-containers
I am assuming your query is - Given a PID, how to find the container in which this process is running? I will try to answer it based on my recent reading on Linux containers. Each container can be configured to start with its own user and group id mappings....
centos,centos7,systemd,cgroups,resource-scheduling
The systemd shipping with RHEL/Centos 7 is based on version 208. That CPUQuota support doesn't appear to be included until 213. You should be able experiment by running the process in the slice/scope you want and then directly modifying the cpu.cfs_{quota,period}_us ratio under /sys/fs/cgroup/cpu/... I expect whatever you set there...
Finally, I read the kernel documentation about cgroups and cpusets, and there is a detail description about how to create and use cgroups step by step.The problem here was that I didn't mount the cgroups. The solution is given below. mount -t tmpfs cgroup_root /sys/fs/cgroup mkdir /sys/fs/cgroup/cpuset mount -t cgroup...
linux,performance,io,centos,cgroups
You need to use the physical device when setting up blkio. Use the major:minor for the whole disk (8:0).
linux,memory-management,process,cgroups
You test is returning success as it doesn't check for error. In fact, the fread call failed allocation when your binary hit the memory limit. You can see that by changing the code to check for error: #include <stdlib.h> #include <stdio.h> #define SIZE (long int) 1*1024*1024*1024*sizeof(char)/*1 GB*/ int main(void) {...
linux,performance,cpu-usage,cgroups
cpu cgroup is work conserving, ie. a task would not be stopped from using cpu if there is no competition. If you want to put a hard limit on amount of cpu a task can use, try setting cpu.cfs_quota_us and cpu.cfs_period_us. Look at the documentation here....
All processes belong to some cgroup when cgroups are enabled. If you didn't set it explicitly, the processes would belong to root cgroup. You can check it through # cat /proc/pid/cgroups CPUs don't get exclusively allocated in cgroups. When you set some cpus for a cgroup - say cpu 0...