|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/2] xen/domain: optimize domain_pause()
Today domain_pause() will call vcpu_sleep_sync() for all vcpus,
meaning that the vcpus are put to sleep one after another.
Optimize that by first calling vcpu_sleep_nosync() for all vcpus and
then wait for all to have entered the sleep state.
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
xen/common/domain.c | 8 ++++----
xen/common/sched/core.c | 10 +++++++---
xen/include/xen/sched.h | 1 +
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 060f0e7a9d..0bef436ef3 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1627,12 +1627,12 @@ static void _domain_pause(struct domain *d, bool sync)
atomic_inc(&d->pause_count);
+ for_each_vcpu ( d, v )
+ vcpu_sleep_nosync(v);
+
if ( sync )
for_each_vcpu ( d, v )
- vcpu_sleep_sync(v);
- else
- for_each_vcpu ( d, v )
- vcpu_sleep_nosync(v);
+ vcpu_wait_sleep(v);
arch_domain_pause(d);
}
diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 10b6eecccd..64a27f27d9 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -1000,10 +1000,8 @@ void vcpu_sleep_nosync(struct vcpu *v)
rcu_read_unlock(&sched_res_rculock);
}
-void vcpu_sleep_sync(struct vcpu *v)
+void vcpu_wait_sleep(struct vcpu *v)
{
- vcpu_sleep_nosync(v);
-
while ( !vcpu_runnable(v) && v->is_running )
cpu_relax();
@@ -1013,6 +1011,12 @@ void vcpu_sleep_sync(struct vcpu *v)
sync_vcpu_execstate(v);
}
+void vcpu_sleep_sync(struct vcpu *v)
+{
+ vcpu_sleep_nosync(v);
+ vcpu_wait_sleep(v);
+}
+
void vcpu_wake(struct vcpu *v)
{
unsigned long flags;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 644cbf70d0..29ecc97c11 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -907,6 +907,7 @@ void vcpu_wake(struct vcpu *v);
long vcpu_yield(void);
void vcpu_sleep_nosync(struct vcpu *v);
void vcpu_sleep_sync(struct vcpu *v);
+void vcpu_wait_sleep(struct vcpu *v);
void vcpu_kick(struct vcpu *v);
/*
--
2.56.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |