From: ChenLiang <[email protected]>

Previously, the strength to throttle vcpu is constant that is too
arbitrarily. This patch(suggested by Juan) increases the strength
according to the times of memory iterator.

Signed-off-by: ChenLiang <[email protected]>
Signed-off-by: Gonglei <[email protected]>
---
 arch_init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch_init.c b/arch_init.c
index 8ddaf35..02436e3 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -1372,8 +1372,10 @@ TargetInfo *qmp_query_target(Error **errp)
    VM to run inside qemu via async_run_on_cpu()*/
 static void mig_sleep_cpu(void *opq)
 {
+    uint64_t sleep_ms = bitmap_sync_count < 30 ? bitmap_sync_count : 30;
+
     qemu_mutex_unlock_iothread();
-    g_usleep(30*1000);
+    g_usleep(sleep_ms*1000);
     qemu_mutex_lock_iothread();
 }
 
-- 
1.7.12.4



Reply via email to