|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] credi2-ratelimit: Implement rate limit for credit2 scheduler
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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |