public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* How cpu entitlement is calculated/enforce for cpu subgroup?
@ 2014-09-15  0:51 John Wei
  2014-09-15  2:46 ` james
  0 siblings, 1 reply; 3+ messages in thread
From: John Wei @ 2014-09-15  0:51 UTC (permalink / raw)
  To: 'LKML-cgroups'

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How cpu entitlement is calculated/enforce for cpu subgroup?
  2014-09-15  0:51 How cpu entitlement is calculated/enforce for cpu subgroup? John Wei
@ 2014-09-15  2:46 ` james
       [not found]   ` <CAKTCnzkVx7_aeTrYKQCBXoSj2w4z-cMSqOEYJRkLVAEGz_bdrA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: james @ 2014-09-15  2:46 UTC (permalink / raw)
  To: John Wei, 'LKML-cgroups'

在 2014年09月15日 08:51, 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
> 
> 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.

> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How cpu entitlement is calculated/enforce for cpu subgroup?
       [not found]     ` <CAKTCnzkVx7_aeTrYKQCBXoSj2w4z-cMSqOEYJRkLVAEGz_bdrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-09-15  4:52       ` Balbir Singh
  0 siblings, 0 replies; 3+ messages in thread
From: Balbir Singh @ 2014-09-15  4:52 UTC (permalink / raw)
  To: james; +Cc: John Wei, LKML-cgroups

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-15  4:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15  0:51 How cpu entitlement is calculated/enforce for cpu subgroup? John Wei
2014-09-15  2:46 ` james
     [not found]   ` <CAKTCnzkVx7_aeTrYKQCBXoSj2w4z-cMSqOEYJRkLVAEGz_bdrA@mail.gmail.com>
     [not found]     ` <CAKTCnzkVx7_aeTrYKQCBXoSj2w4z-cMSqOEYJRkLVAEGz_bdrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-15  4:52       ` Balbir Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox