[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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@xxxxxxxx> --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -835,8 +835,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; @@ -1593,17 +1594,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 @@ -1324,6 +1324,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; Attachment:
sched-ratelimit-check.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |