xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <juergen.gross@ts.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] full support of setting scheduler parameters on domain	creation
Date: Mon, 21 May 2012 13:46:50 +0200	[thread overview]
Message-ID: <10457bda81c6aea95bbf.1337600810@nehalem1> (raw)

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

Obtains current scheduler parameters before modifying any settings specified
via domain config. Only specified settings must be modified, of course!

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>


3 files changed, 37 insertions(+), 24 deletions(-)
tools/libxl/libxl_dom.c     |   25 +++++++++++++++++--------
tools/libxl/libxl_types.idl |    8 ++++++++
tools/libxl/xl_cmdimpl.c    |   28 ++++++++++++----------------



[-- Attachment #2: xen-staging.hg.patch --]
[-- Type: text/x-patch, Size: 5018 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1337599961 -7200
# Node ID 10457bda81c6aea95bbf828dc0458b1eb1232c6d
# Parent  238900a4ed227d04c164d4cd12dfc66f7a25b946
full support of setting scheduler parameters on domain creation

Obtains current scheduler parameters before modifying any settings specified
via domain config. Only specified settings must be modified, of course!

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>

diff -r 238900a4ed22 -r 10457bda81c6 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c	Mon May 21 12:03:32 2012 +0200
+++ b/tools/libxl/libxl_dom.c	Mon May 21 13:32:41 2012 +0200
@@ -54,20 +54,29 @@ int libxl__sched_set_params(libxl__gc *g
     sched = libxl_get_scheduler (ctx);
     switch (sched) {
     case LIBXL_SCHEDULER_SEDF:
-      sedf_info.period = scparams->period;
-      sedf_info.slice = scparams->slice;
-      sedf_info.latency = scparams->latency;
-      sedf_info.extratime = scparams->extratime;
-      sedf_info.weight = scparams->weight;
+      ret = libxl_sched_sedf_domain_get(ctx, domid, &sedf_info);
+      if (ret)
+          break;
+      if (scparams->set_period) sedf_info.period = scparams->period;
+      if (scparams->set_slice) sedf_info.slice = scparams->slice;
+      if (scparams->set_latency) sedf_info.latency = scparams->latency;
+      if (scparams->set_extratime) sedf_info.extratime = scparams->extratime;
+      if (scparams->set_weight) sedf_info.weight = scparams->weight;
       ret=libxl_sched_sedf_domain_set(ctx, domid, &sedf_info);
       break;
     case LIBXL_SCHEDULER_CREDIT:
-      credit_info.weight = scparams->weight;
-      credit_info.cap = scparams->cap;
+      ret = libxl_sched_credit_domain_get(ctx, domid, &credit_info);
+      if (ret)
+          break;
+      if (scparams->set_weight) credit_info.weight = scparams->weight;
+      if (scparams->set_cap) credit_info.cap = scparams->cap;
       ret=libxl_sched_credit_domain_set(ctx, domid, &credit_info);
       break;
     case LIBXL_SCHEDULER_CREDIT2:
-      credit2_info.weight = scparams->weight;
+      ret = libxl_sched_credit2_domain_get(ctx, domid, &credit2_info);
+      if (ret)
+          break;
+      if (scparams->set_weight) credit2_info.weight = scparams->weight;
       ret=libxl_sched_credit2_domain_set(ctx, domid, &credit2_info);
       break;
     default:
diff -r 238900a4ed22 -r 10457bda81c6 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Mon May 21 12:03:32 2012 +0200
+++ b/tools/libxl/libxl_types.idl	Mon May 21 13:32:41 2012 +0200
@@ -233,6 +233,14 @@ libxl_sched_params = Struct("sched_param
     ("slice",        integer),
     ("latency",      integer),
     ("extratime",    integer),
+    ("set_weight",       bool),
+    ("set_cap",          bool),
+    ("set_tslice_ms",    bool),
+    ("set_ratelimit_us", bool),
+    ("set_period",       bool),
+    ("set_slice",        bool),
+    ("set_latency",      bool),
+    ("set_extratime",    bool),
     ], dir=DIR_IN)
 
 # Instances of libxl_file_reference contained in this struct which
diff -r 238900a4ed22 -r 10457bda81c6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Mon May 21 12:03:32 2012 +0200
+++ b/tools/libxl/xl_cmdimpl.c	Mon May 21 13:32:41 2012 +0200
@@ -628,22 +628,18 @@ static void parse_config_data(const char
     libxl_domain_build_info_init_type(b_info, c_info->type);
 
     /* the following is the actual config parsing with overriding values in the structures */
-    if (!xlu_cfg_get_long (config, "cpu_weight", &l, 0))
-        b_info->sched_params.weight = l;
-    if (!xlu_cfg_get_long (config, "cap", &l, 0))
-        b_info->sched_params.cap = l;
-    if (!xlu_cfg_get_long (config, "tslice_ms", &l, 0))
-        b_info->sched_params.tslice_ms = l;
-    if (!xlu_cfg_get_long (config, "ratelimit_us", &l, 0))
-        b_info->sched_params.ratelimit_us = l;
-    if (!xlu_cfg_get_long (config, "period", &l, 0))
-        b_info->sched_params.period = l;
-    if (!xlu_cfg_get_long (config, "slice", &l, 0))
-        b_info->sched_params.period = l;
-    if (!xlu_cfg_get_long (config, "latency", &l, 0))
-        b_info->sched_params.period = l;
-    if (!xlu_cfg_get_long (config, "extratime", &l, 0))
-        b_info->sched_params.period = l;
+#define __set_sched_par(s,x,t) if ((b_info->sched_params.s =       \
+        !xlu_cfg_get_long (config, t, &l, 0)))                     \
+            b_info->sched_params.x = l
+    __set_sched_par(set_weight, weight, "cpu_weight");
+    __set_sched_par(set_cap, cap, "cap");
+    __set_sched_par(set_tslice_ms, tslice_ms, "tslice_ms");
+    __set_sched_par(set_ratelimit_us, ratelimit_us, "ratelimit_us");
+    __set_sched_par(set_period, period, "period");
+    __set_sched_par(set_slice, slice, "slice");
+    __set_sched_par(set_latency, latency, "latency");
+    __set_sched_par(set_extratime, extratime, "extratime");
+#undef __set_sched_par
 
     if (!xlu_cfg_get_long (config, "vcpus", &l, 0)) {
         b_info->max_vcpus = l;

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

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

             reply	other threads:[~2012-05-21 11:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21 11:46 Juergen Gross [this message]
2012-05-21 12:07 ` [PATCH] full support of setting scheduler parameters on domain creation Ian Campbell
2012-05-21 13:23   ` Juergen Gross
2012-05-21 13:34     ` Ian Campbell
2012-05-21 13:48       ` Juergen Gross
2012-05-21 13:48       ` George Dunlap
2012-05-21 13:53         ` Ian Campbell
2012-05-22  5:43           ` Juergen Gross
2012-05-22  7:42             ` Dario Faggioli
2012-05-22  7:47               ` Juergen Gross

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=10457bda81c6aea95bbf.1337600810@nehalem1 \
    --to=juergen.gross@ts.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /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).