qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 15/18] COLO: flush host dirty ram from cache


From: zhanghailiang
Subject: [Qemu-devel] [PATCH v2 15/18] COLO: flush host dirty ram from cache
Date: Sat, 22 Apr 2017 16:25:55 +0800

Don't need to flush all VM's ram from cache, only
flush the dirty pages since last checkpoint

Cc: Juan Quintela <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
Signed-off-by: Zhang Chen <address@hidden>
Signed-off-by: zhanghailiang <address@hidden>
---
v2:
 - stop dirty log after exit from COLO state. (Dave)
---
 migration/ram.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/migration/ram.c b/migration/ram.c
index f171a82..7bf3515 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2775,6 +2775,7 @@ int colo_init_ram_cache(void)
     ram_state.ram_bitmap = g_new0(RAMBitmap, 1);
     ram_state.ram_bitmap->bmap = bitmap_new(last_ram_page());
     ram_state.migration_dirty_pages = 0;
+    memory_global_dirty_log_start();
 
     return 0;
 
@@ -2798,6 +2799,7 @@ void colo_release_ram_cache(void)
 
     atomic_rcu_set(&ram_state.ram_bitmap, NULL);
     if (bitmap) {
+        memory_global_dirty_log_stop();
         call_rcu(bitmap, migration_bitmap_free, rcu);
     }
 
@@ -2822,6 +2824,16 @@ void colo_flush_ram_cache(void)
     void *src_host;
     unsigned long offset = 0;
 
+    memory_global_dirty_log_sync();
+    qemu_mutex_lock(&ram_state.bitmap_mutex);
+    rcu_read_lock();
+    QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
+        migration_bitmap_sync_range(&ram_state, block, block->offset,
+                                    block->used_length);
+    }
+    rcu_read_unlock();
+    qemu_mutex_unlock(&ram_state.bitmap_mutex);
+
     trace_colo_flush_ram_cache_begin(ram_state.migration_dirty_pages);
     rcu_read_lock();
     block = QLIST_FIRST_RCU(&ram_list.blocks);
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]