WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 11 of 16] credit2: Track expected load

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 11 of 16] credit2: Track expected load
From: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
Date: Thu, 23 Dec 2010 12:38:43 +0000
Cc: george.dunlap@xxxxxxxxxxxxx
Delivery-date: Thu, 23 Dec 2010 04:49:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1293107912@xxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <patchbomb.1293107912@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.3
As vcpus are migrated, track how we expect the load to change.  This helps
smooth migrations when the balancing doesn't take immediate effect on
the load average.  In theory, if vcpu activity remains constant, then the
measured avgload should converge to the balanced avgload.

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

diff -r 0b950f9d3332 -r 7bb94bc97cc0 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c        Thu Dec 23 12:26:13 2010 +0000
+++ b/xen/common/sched_credit2.c        Thu Dec 23 12:26:28 2010 +0000
@@ -206,6 +206,7 @@
     int load;              /* Instantaneous load: Length of queue  + num 
non-idle threads */
     s_time_t load_last_update;  /* Last time average was updated */
     s_time_t avgload;           /* Decaying queue load */
+    s_time_t b_avgload;         /* Decaying queue load modified by balancing */
 };
 
 /*
@@ -302,6 +303,7 @@
     if ( rqd->load_last_update + (1ULL<<prv->load_window_shift) < now )
     {
         rqd->avgload = (unsigned long long)rqd->load << prv->load_window_shift;
+        rqd->b_avgload = (unsigned long long)rqd->load << 
prv->load_window_shift;
     }
     else
     {
@@ -310,6 +312,10 @@
         rqd->avgload =
             ( ( delta * ( (unsigned long long)rqd->load << 
prv->load_window_shift ) )
               + ( ((1ULL<<prv->load_window_shift) - delta) * rqd->avgload ) ) 
>> prv->load_window_shift;
+
+        rqd->b_avgload =
+            ( ( delta * ( (unsigned long long)rqd->load << 
prv->load_window_shift ) )
+              + ( ((1ULL<<prv->load_window_shift) - delta) * rqd->b_avgload ) 
) >> prv->load_window_shift;
     }
     rqd->load += change;
     rqd->load_last_update = now;
@@ -317,11 +323,12 @@
     {
         struct {
             unsigned rq_load:4, rq_avgload:28;
-            unsigned rq_id:4;
+            unsigned rq_id:4, b_avgload:28;
         } d;
         d.rq_id=rqd->id;
         d.rq_load = rqd->load;
         d.rq_avgload = rqd->avgload;
+        d.b_avgload = rqd->b_avgload;
         trace_var(TRC_CSCHED2_UPDATE_RUNQ_LOAD, 1,
                   sizeof(d),
                   (unsigned char *)&d);
@@ -756,6 +763,9 @@
 
     update_max_weight(svc->rqd, svc->weight, 0);
 
+    /* Expected new load based on adding this vcpu */
+    rqd->b_avgload += svc->avgload;
+
     /* TRACE */
     {
         struct {
@@ -790,6 +800,9 @@
     list_del_init(&svc->rqd_elem);
     update_max_weight(svc->rqd, 0, svc->weight);
 
+    /* Expected new load based on removing this vcpu */
+    svc->rqd->b_avgload -= svc->avgload;
+
     svc->rqd = NULL;
 }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

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