Improve vcpu_migration_delay handling.
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 11 Mar 2009 10:12:14 +0000 (10:12 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 11 Mar 2009 10:12:14 +0000 (10:12 +0000)
Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
xen/common/sched_credit.c
xen/common/schedule.c
xen/include/xen/sched.h

index 8afd1d1a8c892b7680a2f162130c7894e6d0ade2..f2c3cde0fdd481ecf6ebe6e110d30f7839c021ef 100644 (file)
@@ -328,7 +328,7 @@ integer_param("vcpu_migration_delay", vcpu_migration_delay);
 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 )
index 99f57a232d470da5e55374e2e0894bdc63627315..7ce18b14e9b3209962b9dcb54d8ffd7e60917c2c 100644 (file)
@@ -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);
index aa4c7173dfc53ccd88b4fcbca17950b0c814dc5d..9b58a7b64b4920945bc77f6560d5786cebf4d4e2 100644 (file)
@@ -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? */