aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/sched_credit.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-08-09 16:37:33 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-08-09 16:37:33 +0100
commitc92d5f4e0f1cc92d61934838f12da568e7da1643 (patch)
tree9a9fe2f915a9d5d67ac7c24d170b194f7389cc27 /xen/common/sched_credit.c
parent5fc9f5ef6c083641b55ddcab8cb6a041656fb3bd (diff)
downloadxen-c92d5f4e0f1cc92d61934838f12da568e7da1643.tar.gz
xen-c92d5f4e0f1cc92d61934838f12da568e7da1643.tar.bz2
xen-c92d5f4e0f1cc92d61934838f12da568e7da1643.zip
Credit1: Tweak reset condition
VMs that don't use their full timeslice are guaranteed to flip back and forth between "active" and "inactive". If we set credit to 0 when setting "inactive", then when the VM comes back to "active" again, it will effectively be behind most other vcpus in credit. This causes the credit1 to effectively discriminate *against* VMs which use less than their full timeslice. Instead of setting credit to 0, divide it in half. This gets rid of some of the system credit while allowing non-cpu-bound VMs to keep some priority advantage. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Diffstat (limited to 'xen/common/sched_credit.c')
-rw-r--r--xen/common/sched_credit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index c2c0f2bf2f..95384cabe0 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1100,7 +1100,9 @@ csched_acct(void* dummy)
if ( credit > CSCHED_CREDITS_PER_TSLICE )
{
__csched_vcpu_acct_stop_locked(prv, svc);
- credit = 0;
+ /* Divide credits in half, so that when it starts
+ * accounting again, it starts a little bit "ahead" */
+ credit /= 2;
atomic_set(&svc->credit, credit);
}
}