From ceafa45a048042394b80c99edcb45a249b7aa11c Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 11 Mar 2009 10:12:14 +0000 Subject: [PATCH] Improve vcpu_migration_delay handling. Signed-off-by: Xiaowei Yang --- xen/common/sched_credit.c | 2 +- xen/common/schedule.c | 1 + xen/include/xen/sched.h | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 8afd1d1a8c..f2c3cde0fd 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -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 ) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 99f57a232d..7ce18b14e9 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -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 --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index aa4c7173df..9b58a7b64b 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -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? */ -- 2.30.2