This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] Credit1: Tweak reset condition

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Credit1: Tweak reset condition
From: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Date: Mon, 9 Aug 2010 12:38:33 +0100
Cc: george.dunlap@xxxxxxxxxxxxx
Delivery-date: Mon, 09 Aug 2010 04:40:20 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
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 (shifting
by one bit for more efficiency).  This gets rid of some of the
system credit while allowing non-cpu-bound VMs to keep some priority

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>

diff -r 6f07d9ac1e7c -r 1a29b22ef2e9 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Thu Aug 05 14:41:14 2010 +0100
+++ b/xen/common/sched_credit.c Mon Aug 09 12:38:12 2010 +0100
@@ -1069,7 +1069,9 @@
                 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 >>= 1;
                     atomic_set(&svc->credit, credit);

Xen-devel mailing list

<Prev in Thread] Current Thread [Next in Thread>