xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Dario Faggioli <dario.faggioli@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Anshul Makkar <anshul.makkar@citrix.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] credi2-ratelimit: Implement rate limit for credit2 scheduler
Date: Wed, 13 Jul 2016 12:08:13 +0100	[thread overview]
Message-ID: <daad0f37-745b-1b11-0ac0-020fd6660a2f@citrix.com> (raw)
In-Reply-To: <1468400021.13039.33.camel@citrix.com>

On 13/07/16 09:53, Dario Faggioli wrote:
>> @@ -1675,9 +1711,19 @@ csched2_runtime(const struct scheduler *ops,
>> int cpu, struct csched2_vcpu *snext
>>       * 1) Run until snext's credit will be 0
>>       * 2) But if someone is waiting, run until snext's credit is
>> equal
>>       * to his
>> -     * 3) But never run longer than MAX_TIMER or shorter than
>> MIN_TIMER.
>> +     * 3) But never run longer than MAX_TIMER or shorter than
>> MIN_TIMER
>> +     * or your the ratelimit time.
>>       */
>>
>> +    /* Calculate mintime */
>> +    min_time = CSCHED2_MIN_TIMER;
>> +    if ( prv->ratelimit_us ) {
>> +        s_time_t ratelimit_min = snext->vcpu-
>>> runstate.state_entry_time +
>> +            MICROSECS(prv->ratelimit_us) - now;
>>
> Here snext can indeed be someone which was running already (e.g., we're
> choosing current again), in which case runstate.state_entry-time-now
> would indeed tell us how long it's actually been running, and the
> formula (coupled with the if below) is correct.
> 
> But it also can be someone which is runnable (e.g., we're choosing
> someone from the runqueue and preempting current), in which case
> runstate.state_entry_time tells when it became runnable, and
> state_entry_time-now is how long it's been runnable, which is not what
> we want here.
> 
> In think, in such a case, we want ratelimit_min to just be equal to
> prv->ratelimit_us. So, maybe, something like this:
> 
>  /* Caluclate mintime */
>  min_time = CSCHED2_MIN_TIMER;
>  if ( prv->ratelimit_us )
>  {
>      s_time_t ratelimit_min = prv->ratelimit_us;
>      if ( snext->vcpu->is_running )     // XXX or is it better snext == curr_on_cpu(cpu)
>          ratelimit_min = snext->vcpu->runstate.state_entry_time +
>                          MICROSECS(prv->ratelimit_us) - now;
>      if ( ratelimit_min > min_time )
>          min_time = ratelimit_min;
>  }

+1

 -George

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

  reply	other threads:[~2016-07-13 11:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 17:33 [PATCH] credi2-ratelimit: Implement rate limit for credit2 scheduler Anshul
2016-07-07  9:59 ` Dario Faggioli
2016-07-12 16:16 ` George Dunlap
2016-07-13  8:53   ` Dario Faggioli
2016-07-13 11:08     ` George Dunlap [this message]
2016-07-18 11:54     ` anshul makkar

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=daad0f37-745b-1b11-0ac0-020fd6660a2f@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=anshul.makkar@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).