Reputation: 390
I have some confusion over how cgroups work. Here's my understanding of these cgroup limits...
So what happens when you bind a process to a specific cpuset, cpu, and memory? Some examples...
Also, how do I know the details/specs of the cores/NUMA nodes that I'm referencing in cpuset?
Upvotes: 1
Views: 1518
Reputation: 116
have the same confusion. But based on my test, if cpuset.cpu_exclusive=0(cores are shared), both cpu.shares and cpuset.cpus work. Test is as following.
create two cgroups: cputest1 and cputest2(same hierarchy under root)
for both cputest1 and cputest2, do:
echo 0,2 > cpuset.cpus echo 0 > cpuset.mems
new terminal a
cd /sys/fs/cgroup/cpuset/cputest1 echo $$ >> cgroup.proc while :; do echo test > /dev/null; done
new terminal b
cd /sys/fs/cgroup/cpuset/cputest1
echo $$ >> cgroup.proc
while :; do echo test > /dev/null; done
new terminal c
cd /sys/fs/cgroup/cpuset/cputest2
echo $$ >> cgroup.proc
while :; do echo test > /dev/null; done
run top, there are three bash tasks, and cpu usage of each task is almost same about(60%-70%), total is 200%
4. terminal a
echo $$ >> /sys/fs/cgroup/cpu/cputest1/cgroup.proc
while :; do echo test > /dev/null; done
terminal b
echo $$ >> /sys/fs/cgroup/cpu/cputest1/cgroup.proc
while :; do echo test > /dev/null; done
terminal c
echo $$ >> /sys/fs/cgroup/cpu/cputest2/cgroup.proc
while :; do echo test > /dev/null; done
echo 2/2048/1024 > /sys/fs/cgroup/cpu/cputest1/cpu.shares
echo 2048/2/1024 > /sys/fs/cgroup/cpu/cputest2/cpu.shares
run top to watch the cpu usage among three bash task
Upvotes: 1