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

Re: [Xen-devel] [PATCH] Add migration_cost option to scheduler

To: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Add migration_cost option to scheduler
From: "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx>
Date: Tue, 10 Mar 2009 18:56:42 +0800
Cc: 'George Dunlap' <George.Dunlap@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 10 Mar 2009 03:57:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <49B5E046.7090406@xxxxxxxxx>
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: <49B4D0C8.5050504@xxxxxxxxx> <de76405a0903090555n4b07cbd0w40a7153cd7c53ea4@xxxxxxxxxxxxxx> <0A882F4D99BBF6449D58E61AAFD7EDD606C4ECE3@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <49B5E046.7090406@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.19 (X11/20090105)


Yang, Xiaowei wrote:
Tian, Kevin wrote:
From: George Dunlap
Sent: Monday, March 09, 2009 8:56 PM

Hmm, I think this patch may not be exactly what we want.  It looks
like it checks for how long a vcpu has been in its current stat, not
how recently it has been running.  So if a vcpu sleeps for a long time
on a cpu that's running other workloads, then wakes up
(blocked->runnable), the cache is by no means "hot".  But since it has
only been in the "runnable" state for a few hundred cycles, it won't
be migrated, even though there's little cost.
Then to add a per-vcpu last_running_timestamp which is recorded when vcpu is scheduled out, could hit the purpose here?
Yes, it's more reasonable. I can make a patch.


The patch is attached. Had a quick test using the previous config and saw no obvious different result with it. May be explained by the fact that the benchmarks has no many IO operations - db and logfile are put to ramdisk for sysbench test. Anyway it's closer to what we really want. Thanks both of you!

Signed-off-by: Xiaowei Yang <xiaowei.yang@xxxxxxxxx>

Thanks,
xiaowei
diff -r 115c97f32dc6 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Tue Mar 10 00:18:39 2009 +0800
+++ b/xen/common/sched_credit.c Tue Mar 10 03:09:44 2009 +0800
@@ -328,7 +328,7 @@ static inline int
 static inline int
 __csched_vcpu_is_cache_hot(struct vcpu *v)
 {
-    int hot = ((NOW() - v->runstate.state_entry_time) <
+    int hot = ((NOW() - v->last_run_time) <
                ((uint64_t)vcpu_migration_delay * 1000u));
 
     if ( hot )
diff -r 115c97f32dc6 xen/common/schedule.c
--- a/xen/common/schedule.c     Tue Mar 10 00:18:39 2009 +0800
+++ b/xen/common/schedule.c     Tue Mar 10 03:00:36 2009 +0800
@@ -836,6 +836,7 @@ static void schedule(void)
         (test_bit(_VPF_blocked, &prev->pause_flags) ? RUNSTATE_blocked :
          (vcpu_runnable(prev) ? RUNSTATE_runnable : RUNSTATE_offline)),
         now);
+    prev->last_run_time = now;
 
     ASSERT(next->runstate.state != RUNSTATE_running);
     vcpu_runstate_change(next, RUNSTATE_running, now);
diff -r 115c97f32dc6 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Tue Mar 10 00:18:39 2009 +0800
+++ b/xen/include/xen/sched.h   Tue Mar 10 02:59:15 2009 +0800
@@ -102,6 +102,9 @@ struct vcpu
     } runstate_guest; /* guest address */
 #endif
 
+    /* last time when vCPU is scheduled out */
+    uint64_t last_run_time;
+
     /* Has the FPU been initialised? */
     bool_t           fpu_initialised;
     /* Has the FPU been used since it was last saved? */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>