[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen: credit2: don't let b_avgload go negative.
commit d933b37eb404f27557e3e8468482c8ddaeaee60e Author: Dario Faggioli <dario.faggioli@xxxxxxxxxx> AuthorDate: Fri Jul 22 14:04:53 2016 +0200 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Fri Jul 22 13:36:30 2016 +0100 xen: credit2: don't let b_avgload go negative. The ASSERT() made effective by b5b5876619bd8ec2e ("xen: credit2: fix two s_time_t handling issues in load balancing") triggers for b_avgload (spotted by OSSTest). b_avgload is where we store the prediction of how the load of a runqueue will look like in the medium to long term, because of a vcpu being added to or removed from there. On vcpu removal, saturate down b_avgload to zero, as it makes very few sense to predict that the load of a runqueue will at some point become negative! Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx> Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx> --- xen/common/sched_credit2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index b92226c..1d79de0 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1323,14 +1323,16 @@ runq_assign(const struct scheduler *ops, struct vcpu *vc) static void __runq_deassign(struct csched2_vcpu *svc) { + struct csched2_runqueue_data *rqd = svc->rqd; + ASSERT(!__vcpu_on_runq(svc)); ASSERT(!(svc->flags & CSFLAG_scheduled)); list_del_init(&svc->rqd_elem); - update_max_weight(svc->rqd, 0, svc->weight); + update_max_weight(rqd, 0, svc->weight); /* Expected new load based on removing this vcpu */ - svc->rqd->b_avgload -= svc->avgload; + rqd->b_avgload = max_t(s_time_t, rqd->b_avgload - svc->avgload, 0); svc->rqd = NULL; } @@ -1590,7 +1592,7 @@ csched2_cpu_pick(const struct scheduler *ops, struct vcpu *vc) if ( rqd == svc->rqd ) { if ( cpumask_intersects(vc->cpu_hard_affinity, &rqd->active) ) - rqd_avgload = rqd->b_avgload - svc->avgload; + rqd_avgload = max_t(s_time_t, rqd->b_avgload - svc->avgload, 0); } else if ( spin_trylock(&rqd->lock) ) { -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |