[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] [XEN] Do not steal work from idle CPUs. This can happen
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 65b33e64b6421fbc8bcb266ecd65278953b75cb1 # Parent 11645dda144c3c8365dd2a6a64cb5a7d7da01170 [XEN] Do not steal work from idle CPUs. This can happen if a idle CPU is in the process of waking up. This fix suggested by Anthony Xu <anthony.xu@xxxxxxxxx> as it can have a significant boost to HVM performance. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> --- xen/common/sched_credit.c | 54 +++++++++++++++++++++++----------------------- 1 files changed, 28 insertions(+), 26 deletions(-) diff -r 11645dda144c -r 65b33e64b642 xen/common/sched_credit.c --- a/xen/common/sched_credit.c Thu Sep 14 08:19:41 2006 +0100 +++ b/xen/common/sched_credit.c Thu Sep 14 16:01:46 2006 +0100 @@ -987,35 +987,37 @@ csched_load_balance(int cpu, struct csch * cause a deadlock if the peer CPU is also load balancing and trying * to lock this CPU. */ - if ( spin_trylock(&per_cpu(schedule_data, peer_cpu).schedule_lock) ) - { - - spc = CSCHED_PCPU(peer_cpu); - if ( unlikely(spc == NULL) ) - { - CSCHED_STAT_CRANK(steal_peer_down); - speer = NULL; - } - else - { - speer = csched_runq_steal(spc, cpu, snext->pri); - } - - spin_unlock(&per_cpu(schedule_data, peer_cpu).schedule_lock); - - /* Got one! */ - if ( speer ) - { - CSCHED_STAT_CRANK(vcpu_migrate); - return speer; - } + if ( !spin_trylock(&per_cpu(schedule_data, peer_cpu).schedule_lock) ) + { + CSCHED_STAT_CRANK(steal_trylock_failed); + continue; + } + + spc = CSCHED_PCPU(peer_cpu); + if ( unlikely(spc == NULL) ) + { + CSCHED_STAT_CRANK(steal_peer_down); + speer = NULL; + } + else if ( is_idle_vcpu(per_cpu(schedule_data, peer_cpu).curr) ) + { + speer = NULL; } else { - CSCHED_STAT_CRANK(steal_trylock_failed); - } - } - + /* Try to steal work from an online non-idle CPU. */ + speer = csched_runq_steal(spc, cpu, snext->pri); + } + + spin_unlock(&per_cpu(schedule_data, peer_cpu).schedule_lock); + + /* Got one? */ + if ( speer ) + { + CSCHED_STAT_CRANK(vcpu_migrate); + return speer; + } + } /* Failed to find more important work */ __runq_remove(snext); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |