aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-06-28 19:51:17 +0200
committerJuan Quintela <quintela@redhat.com>2012-07-20 08:19:27 +0200
commit00d94f3f7648bc3d7126bc6b84d42e22194d9230 (patch)
tree32055b3ca57bf3ff9605362b80e562fa403a1398 /arch_init.c
parentb81e712d252cf41a0825f5abad0ce2f4746864f1 (diff)
downloadqemu-00d94f3f7648bc3d7126bc6b84d42e22194d9230.zip
qemu-00d94f3f7648bc3d7126bc6b84d42e22194d9230.tar.gz
qemu-00d94f3f7648bc3d7126bc6b84d42e22194d9230.tar.bz2
ram: iterate phase
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 <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch_init.c b/arch_init.c
index 3c38a52..b08c615 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);
@@ -398,7 +396,13 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
DPRINTF("ram_save_live: expected(" PRIu64 ") <= max(" PRIu64 ")?\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());
+ expected_time = ram_save_remaining() * TARGET_PAGE_SIZE / bwidth;
+
+ return expected_time <= migrate_max_downtime();
+ }
+ return 0;
}
static int ram_save_complete(QEMUFile *f, void *opaque)