xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Anshul Makkar <anshul.makkar@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 0/4] xen/tools: Credit2: implement caps.
Date: Thu, 08 Jun 2017 14:08:38 +0200	[thread overview]
Message-ID: <149692186557.9605.11625777539060264052.stgit@Solace.fritz.box> (raw)

The fact that a domain has an utilization cap, means the following:

 - a domain with an utilization cap, will not run for more than the cap
   itself;

 - cap is expressed in terms of % of physical CPU time. A domain that must
   not use more than 1/4 of _one_ physical CPU, will be given a cap of 25%;
   a domain that must not use more than 1+1/2 of physical CPU time, will be
   given a cap of 150%;

 - caps are per-domain. So, it's the overall execution time of all the
   vCPUs of the domain that will stay below the cap.

This is implemented as follows:

 - each domain has a budget. This budget is periodically replenished;

 - when the vCPUs run, they burn the budget (in a similar way to how
   they burn credits).

 - the budget is, basically, the amount of time that the vCPUs of the
   domain can use every period;

 - when there is no budget any longer, the vCPUs of the domain can't
   run, and are "parked". When there is some budget again (e.g., because
   of a replenishment, they are "unparked".

This budgetting mechanism is implemented on top of Credit1, and hence it
is completely independent from them, and changing weights of a domain and
setting a cap for it, are orthogonal operations.

Note that caps already exist in Credit1, however, there:
 - because of the way it is implemented, it is very imprecise. E.g., I've
   seen Credit1 domains with caps of 80%, oscillating between 72% and 88%.
   With this patch applied (and using Credit2, of course), I've never seen
   an error bigget than +/- 1% (this is mostly looking at xentop, and doing
   some calculation from traces, I'll investigate more and send in the
   numbers, but so far, so good :-D);
 - because of the way it is implemented, it works very bad (if at all) if
   combined with changing the domains' weights and/or pinning;
 - because of the way it is implemented, it may cause a guest with a cap
   incur in livelock, deadlock, or crash because of watchdogs. With this
   patch applied (and using Credit2, of course), I've not seen anything
   like that (but I'll continue running more tests).

Here's the git branch:
 git://xenbits.xen.org/people/dariof/xen.git  rel/sched/credit2-caps
 http://xenbits.xen.org/gitweb/?p=people/dariof/xen.git;a=shortlog;h=refs/heads/rel/sched/credit2-caps

 https://travis-ci.org/fdario/xen/builds/240749240

Thanks and Regards,
Dario
---
Dario Faggioli (4):
      xen: credit2: implement utilization cap
      xen: credit2: allow to set and get utilization cap
      xen: credit2: improve distribution of budget (for domains with caps)
      libxl/xl: allow to get and set cap on Credit2.

 tools/libxl/libxl_sched.c   |   21 +
 tools/xentrace/formats      |    2 
 tools/xentrace/xenalyze.c   |   10 -
 tools/xl/xl_cmdtable.c      |    1 
 tools/xl/xl_sched.c         |   25 +-
 xen/common/sched_credit2.c  |  623 ++++++++++++++++++++++++++++++++++++++++---
 xen/include/public/domctl.h |    1 
 xen/include/xen/sched.h     |    3 
 8 files changed, 633 insertions(+), 53 deletions(-)
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

             reply	other threads:[~2017-06-08 12:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 12:08 Dario Faggioli [this message]
2017-06-08 12:08 ` [PATCH 1/4] xen: credit2: implement utilization cap Dario Faggioli
2017-06-12 11:16   ` Anshul Makkar
2017-06-12 13:19     ` Dario Faggioli
2017-06-13 16:07       ` Anshul Makkar
2017-06-13 21:13         ` Dario Faggioli
2017-06-15 16:16           ` Anshul Makkar
2017-06-22 16:55   ` George Dunlap
2017-06-23 16:19     ` Dario Faggioli
2017-06-28 14:28       ` George Dunlap
2017-06-28 14:56         ` Dario Faggioli
2017-06-28 19:05           ` George Dunlap
2017-06-29 10:09             ` Dario Faggioli
2017-07-25 14:34               ` George Dunlap
2017-07-25 17:29                 ` Dario Faggioli
2017-07-25 15:08   ` George Dunlap
2017-07-25 16:05     ` Dario Faggioli
2017-06-08 12:08 ` [PATCH 2/4] xen: credit2: allow to set and get " Dario Faggioli
2017-06-28 15:19   ` George Dunlap
2017-06-29 10:21     ` Dario Faggioli
2017-06-29  7:39   ` Alan Robinson
2017-06-29  8:26     ` George Dunlap
2017-06-08 12:09 ` [PATCH 3/4] xen: credit2: improve distribution of budget (for domains with caps) Dario Faggioli
2017-06-28 16:02   ` George Dunlap
2017-06-08 12:09 ` [PATCH 4/4] libxl/xl: allow to get and set cap on Credit2 Dario Faggioli
2017-06-09 10:41   ` Wei Liu
2017-06-28 18:43   ` George Dunlap
2017-06-29 10:22     ` Dario Faggioli

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=149692186557.9605.11625777539060264052.stgit@Solace.fritz.box \
    --to=dario.faggioli@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anshul.makkar@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).