How cpu entitlement is calculated/enforce for cpu subgroup?
I understand that CPU entitlement is based on cpu.share. If all the groups are defined at first level, that is simple.
Once subgroups are defined, cgroups behave differently.
If you define cgroups hierarchy, then CPU entitlement is enforced base on the cpu.share of "each" group and subgroup.
For example:
* group A has 1024 cpu.share
Group A has two subgroup: A1, A2. Each has 1024 cpu.share
* group B has 1024 cpu.share
If you run process(es) in group, A, A1, A2, and, B. Each group and subgroups get 25% of all the CPU.
Below is an example on defining cgroup hierarchy
Cpu = /cgroups/hierarchy
Cpuacct = /cgroup/hierarch
Memory = /cgroup/hierarch
If you do not define cgroup hierarchy, then cgroup treat A/A1/A2 as one group and will get 50% CPU, and B will get 50% as well.
I can understand the reason why it is implemented this way. But, I don't understand how cgroup divide that 50% between A, A1, and A2. During my testing, I found A1 and A2 received 10%, while the processes in group A received about 30% CPU. All together, processes in A/A1/A2 received about 50% CPU.
What is the formulate for this scenario? Is there a document for this.
John
Quoted 17 lines · John Wei
I understand that CPU entitlement is based on cpu.share. If all the groups are defined at first level, that is simple.
Once subgroups are defined, cgroups behave differently.
If you define cgroups hierarchy, then CPU entitlement is enforced base on the cpu.share of "each" group and subgroup.
For example:
* group A has 1024 cpu.share
Group A has two subgroup: A1, A2. Each has 1024 cpu.share
* group B has 1024 cpu.share
If you run process(es) in group, A, A1, A2, and, B. Each group and subgroups get 25% of all the CPU.Below is an example on defining cgroup hierarchy
Cpu = /cgroups/hierarchy
Cpuacct = /cgroup/hierarch
Memory = /cgroup/hierarch
Quoted 8 lines
If you do not define cgroup hierarchy, then cgroup treat A/A1/A2 as one group and will get 50% CPU, and B will get 50% as well.
I can understand the reason why it is implemented this way. But, I don't understand how cgroup divide that 50% between A, A1, and A2. During my testing, I found A1 and A2 received 10%, while the processes in group A received about 30% CPU. All together, processes in A/A1/A2 received about 50% CPU.
hi sir,
I'm a nobody.
when there are 2 groups in level 1st (A and B), then A=50% and B=50%(because A=1024 , B=1024 they are same. so they will have the same priority get cpu time).
and in the subgroup should following above-mentioned rules.(in same level).
And in this scenario ,when B group no processes,then A group will be 100%.
ok ,this is my point.
welcome any body to correct me.
Quoted 10 lines
What is the formulate for this scenario? Is there a document for this.
John
--
To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Use weights to understand how it works. A/A1/A2 can be written as
A
A1 A2
50% of A for A1 and A2 and 50% for the task in A. A itself receives 50% of the CPU. So the task in A gets 25% and the remaining A1 and A2 get 12.5% each (add up to 25%)
Ideally you should see a distribution of 12.5, 12. 5 and 25, but due to round up and short term monitoring, you might see 10, 10, 30