On 6/28/2012 11:22 PM, Juan Quintela wrote:
We only need to synchronize the bitmap when the number of dirty pages is low.
Not every time that we call the function.
Signed-off-by: Juan Quintela <quint...@redhat.com>
---
arch_init.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index fe843a7..8299c15 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -348,8 +348,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
int i;
uint64_t expected_time;
- memory_global_sync_dirty_bitmap(get_system_memory());
-
bytes_transferred_last = bytes_transferred;
bwidth = qemu_get_clock_ns(rt_clock);
@@ -397,7 +395,12 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
DPRINTF("ram_save_live: expected(%ld) <= max(%ld)?\n", expected_time,
migrate_max_downtime());
- return expected_time <= migrate_max_downtime();
+ if (expected_time <= migrate_max_downtime()) {
+ memory_global_sync_dirty_bitmap(get_system_memory());
+
+ return expected_time <= migrate_max_downtime();
Shouldn't expected_time be recalculated after
memory_global_sync_dirty_bitmap()?
+ }
+ return 0;
}
static int ram_save_complete(QEMUFile *f, void *opaque)