If vcpu x has run for 200us, and sched_ratelimit_us is 1000us, continue running x _but_ return 1000us-200us as the next time slice. This way, next scheduling point will happen in 800us, i.e., exactly at the point when x crosses the threshold, and can be descheduled (if appropriate).
Right now (without this patch), we're always returning sched_ratelimit_us (1000us, in the example above), which means we're (potentially) allowing x to run more than it should have been able to (even when considering rate limiting into account). Signed-off-by: Dario Faggioli <dario.faggi...@citrix.com> --- Cc: George Dunlap <george.dun...@eu.citrix.com> --- xen/common/sched_credit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 3d4f223..3f439a0 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -1782,7 +1782,7 @@ csched_schedule( snext = scurr; snext->start_time += now; perfc_incr(delay_ms); - tslice = MICROSECS(prv->ratelimit_us); + tslice = MICROSECS(prv->ratelimit_us) - runtime; ret.migrated = 0; goto out; } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel