xen: sched: Credit2: avoid looping too much (over runqueues) during load balancing
authorDario Faggioli <dfaggioli@suse.com>
Wed, 21 Nov 2018 15:44:53 +0000 (15:44 +0000)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 21 Nov 2018 15:44:53 +0000 (15:44 +0000)
commit07ee667d3b7a501a666a9c125996c0cfa12f165f
tree1dfbe9595f9121e4a101884fc5e7377cabe7b465
parent56d2e9786a3ba7b9a92ea3e9fac18e2892f9f38b
xen: sched: Credit2: avoid looping too much (over runqueues) during load balancing

For doing load balancing between runqueues, we check the load of each
runqueue, select the one more "distant" than our own load, and then take
the proper runq lock and attempt vcpu migrations.

If we fail to take such lock, we try again, and the idea was to give up
and bail if, during the checking phase, we can't take the lock of any
runqueue (check the comment near to the 'goto retry;', in the middle of
balance_load())

However, the variable that controls the "give up and bail" part, is not
reset upon retries. Therefore, provided we did manage to check the load of
at least one runqueue during the first pass, if we can't get any runq lock,
we don't bail, but we try again taking the lock of that same runqueue
(and that may even more than once).

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c