From: George Dunlap <george.dunlap@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: george.dunlap@eu.citrix.com
Subject: [PATCH 04 of 10] xen: Implement SCHEDOP sysctl for credit scheduler
Date: Tue, 21 Feb 2012 13:34:10 +0000 [thread overview]
Message-ID: <4ce1812b024997b9684b.1329831250@kodo2> (raw)
In-Reply-To: <patchbomb.1329831246@kodo2>
Allow tslice_ms and ratelimit_us to be modified.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r 38e532667238 -r 4ce1812b0249 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Tue Feb 21 11:44:19 2012 +0000
+++ b/xen/common/sched_credit.c Tue Feb 21 12:14:18 2012 +0000
@@ -833,6 +833,36 @@ csched_dom_cntl(
return 0;
}
+static int
+csched_sys_cntl(const struct scheduler *ops,
+ struct xen_sysctl_scheduler_op *sc)
+{
+ int rc = -EINVAL;
+ xen_sysctl_credit_schedule_t *params = &sc->u.sched_credit;
+ struct csched_private *prv = CSCHED_PRIV(ops);
+
+ switch ( sc->cmd )
+ {
+ case XEN_SYSCTL_SCHEDOP_putinfo:
+ if (params->tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+ || params->tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN
+ || params->ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+ || params->ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN
+ || MICROSECS(params->ratelimit_us) > MILLISECS(params->tslice_ms) )
+ goto out;
+ prv->tslice_ms = params->tslice_ms;
+ prv->ratelimit_us = params->ratelimit_us;
+ /* FALLTHRU */
+ case XEN_SYSCTL_SCHEDOP_getinfo:
+ params->tslice_ms = prv->tslice_ms;
+ params->ratelimit_us = prv->ratelimit_us;
+ rc = 0;
+ break;
+ }
+ out:
+ return rc;
+}
+
static void *
csched_alloc_domdata(const struct scheduler *ops, struct domain *dom)
{
@@ -1566,6 +1596,28 @@ csched_init(struct scheduler *ops)
INIT_LIST_HEAD(&prv->active_sdom);
prv->master = UINT_MAX;
+ if ( sched_credit_tslice_ms > XEN_SYSCTL_CSCHED_TSLICE_MAX
+ || sched_credit_tslice_ms < XEN_SYSCTL_CSCHED_TSLICE_MIN )
+ {
+ printk("WARNING: sched_credit_tslice_ms outside of valid range [%d,%d].\n"
+ " Resetting to default %u\n",
+ XEN_SYSCTL_CSCHED_TSLICE_MIN,
+ XEN_SYSCTL_CSCHED_TSLICE_MAX,
+ CSCHED_DEFAULT_TSLICE_MS);
+ sched_credit_tslice_ms = CSCHED_DEFAULT_TSLICE_MS;
+ }
+
+ if ( sched_ratelimit_us > XEN_SYSCTL_SCHED_RATELIMIT_MAX
+ || sched_ratelimit_us < XEN_SYSCTL_SCHED_RATELIMIT_MIN )
+ {
+ printk("WARNING: sched_ratelimit_us outside of valid range [%d,%d].\n"
+ " Resetting to default %u\n",
+ XEN_SYSCTL_SCHED_RATELIMIT_MIN,
+ XEN_SYSCTL_SCHED_RATELIMIT_MAX,
+ SCHED_DEFAULT_RATELIMIT_US);
+ sched_ratelimit_us = SCHED_DEFAULT_RATELIMIT_US;
+ }
+
prv->tslice_ms = sched_credit_tslice_ms;
prv->ticks_per_tslice = CSCHED_TICKS_PER_TSLICE;
if ( prv->tslice_ms < prv->ticks_per_tslice )
@@ -1641,6 +1693,7 @@ const struct scheduler sched_credit_def
.yield = csched_vcpu_yield,
.adjust = csched_dom_cntl,
+ .adjust_global = csched_sys_cntl,
.pick_cpu = csched_cpu_pick,
.do_schedule = csched_schedule,
diff -r 38e532667238 -r 4ce1812b0249 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h Tue Feb 21 11:44:19 2012 +0000
+++ b/xen/include/public/sysctl.h Tue Feb 21 12:14:18 2012 +0000
@@ -564,6 +564,19 @@ struct xen_sysctl_arinc653_schedule {
typedef struct xen_sysctl_arinc653_schedule xen_sysctl_arinc653_schedule_t;
DEFINE_XEN_GUEST_HANDLE(xen_sysctl_arinc653_schedule_t);
+struct xen_sysctl_credit_schedule {
+ /* Length of timeslice in milliseconds */
+#define XEN_SYSCTL_CSCHED_TSLICE_MAX 1000
+#define XEN_SYSCTL_CSCHED_TSLICE_MIN 1
+ unsigned tslice_ms;
+ /* Rate limit (minimum timeslice) in microseconds */
+#define XEN_SYSCTL_SCHED_RATELIMIT_MAX 500000
+#define XEN_SYSCTL_SCHED_RATELIMIT_MIN 100
+ unsigned ratelimit_us;
+};
+typedef struct xen_sysctl_credit_schedule xen_sysctl_credit_schedule_t;
+DEFINE_XEN_GUEST_HANDLE(xen_sysctl_credit_schedule_t);
+
/* XEN_SYSCTL_scheduler_op */
/* Set or get info? */
#define XEN_SYSCTL_SCHEDOP_putinfo 0
@@ -576,6 +589,7 @@ struct xen_sysctl_scheduler_op {
struct xen_sysctl_sched_arinc653 {
XEN_GUEST_HANDLE_64(xen_sysctl_arinc653_schedule_t) schedule;
} sched_arinc653;
+ struct xen_sysctl_credit_schedule sched_credit;
} u;
};
typedef struct xen_sysctl_scheduler_op xen_sysctl_scheduler_op_t;
next prev parent reply other threads:[~2012-02-21 13:34 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-21 13:34 [PATCH 00 of 10] Allow user to configure credit scheduler parameters George Dunlap
2012-02-21 13:34 ` [PATCH 01 of 10] cleanup: Remove dependency files in efi directory during a make clean George Dunlap
2012-02-21 13:34 ` [PATCH 02 of 10] xen: Add a #define for the default ratelimit George Dunlap
2012-02-21 13:34 ` [PATCH 03 of 10] xen: Print ratelimit in scheduler debugkey George Dunlap
2012-02-21 13:34 ` George Dunlap [this message]
2012-02-21 13:34 ` [PATCH 05 of 10] libxc: Implement SCHEDOP sysctl for credit scheduler George Dunlap
2012-02-21 17:49 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 06 of 10] libxl: cleanup: Remove pointless ERRNOVAL George Dunlap
2012-02-21 17:46 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 07 of 10] libxl: Rename libxl_sched_* to include _domain George Dunlap
2012-02-21 17:52 ` Ian Jackson
2012-02-21 17:54 ` George Dunlap
2012-02-21 13:34 ` [PATCH 08 of 10] libxl: Implement libxl_sched_credit_param_[gs]et George Dunlap
2012-02-21 17:51 ` Ian Jackson
2012-02-21 17:56 ` George Dunlap
2012-02-21 17:57 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 09 of 10] xl: Refactor sched_domain_output to have a callback for pool information George Dunlap
2012-02-21 17:49 ` Ian Jackson
2012-02-21 13:34 ` [PATCH 10 of 10] xl: Implement sched-credit schedule parameter command-line interface George Dunlap
2012-02-21 17:56 ` Ian Jackson
2012-02-21 18:11 ` George Dunlap
2012-02-21 18:17 ` Ian Jackson
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=4ce1812b024997b9684b.1329831250@kodo2 \
--to=george.dunlap@eu.citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.