71 lines
2.9 KiB
Diff
71 lines
2.9 KiB
Diff
# HG changeset patch
|
|
# User Jan Beulich <jbeulich@suse.com>
|
|
# Date 1355134467 -3600
|
|
# Node ID 8d209624ea83b272e1ebd713a928c38d4782f4f1
|
|
# Parent f96a0cda12160f497981a37f6922a1ed7db9a462
|
|
scheduler: fix rate limit range checking
|
|
|
|
For one, neither of the two checks permitted for the documented value
|
|
of zero (disabling the functionality altogether).
|
|
|
|
Second, the range checking of the command line parameter was done by
|
|
the credit scheduler's initialization code, despite it being a generic
|
|
scheduler option.
|
|
|
|
Signed-off-by: Jan Beulich <jbeulich@suse.com>
|
|
Acked-by: Keir Fraser <keir@xen.org>
|
|
|
|
--- a/xen/common/sched_credit.c
|
|
+++ b/xen/common/sched_credit.c
|
|
@@ -846,8 +846,9 @@ csched_sys_cntl(const struct scheduler *
|
|
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
|
|
+ || (params->ratelimit_us
|
|
+ && (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;
|
|
@@ -1607,17 +1608,6 @@ csched_init(struct scheduler *ops)
|
|
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 )
|
|
--- a/xen/common/schedule.c
|
|
+++ b/xen/common/schedule.c
|
|
@@ -1322,6 +1322,18 @@ void __init scheduler_init(void)
|
|
if ( SCHED_OP(&ops, init) )
|
|
panic("scheduler returned error on init\n");
|
|
|
|
+ if ( sched_ratelimit_us &&
|
|
+ (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;
|
|
+ }
|
|
+
|
|
idle_domain = domain_create(DOMID_IDLE, 0, 0);
|
|
BUG_ON(IS_ERR(idle_domain));
|
|
idle_domain->vcpu = idle_vcpu;
|