public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: "John Wei" <johntwei-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: 'LKML-cgroups' <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: How cpu entitlement is calculated/enforce for cpu subgroup?
Date: Sun, 14 Sep 2014 17:51:05 -0700	[thread overview]
Message-ID: <08a001cfd07f$2219bd90$664d38b0$@gmail.com> (raw)

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


             reply	other threads:[~2014-09-15  0:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15  0:51 John Wei [this message]
2014-09-15  2:46 ` How cpu entitlement is calculated/enforce for cpu subgroup? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='08a001cfd07f$2219bd90$664d38b0$@gmail.com' \
    --to=johntwei-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox