[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] scheduler: fix rate limit range checking


  • To: Jan Beulich <JBeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxx>
  • From: Keir Fraser <keir@xxxxxxx>
  • Date: Fri, 07 Dec 2012 15:09:54 +0000
  • Delivery-date: Fri, 07 Dec 2012 15:10:25 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: Ac3UjOlnZZmls3CDqkytKu8U1TQSHg==
  • Thread-topic: [Xen-devel] [PATCH] scheduler: fix rate limit range checking

On 07/12/2012 11:01, "Jan Beulich" <JBeulich@xxxxxxxx> wrote:

> 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>

Acked-by: Keir Fraser <keir@xxxxxxx>

> --- 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;
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.