qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH COLO-Frame v5 12/29] arch_init: Start to trace dirty


From: zhanghailiang
Subject: [Qemu-devel] [PATCH COLO-Frame v5 12/29] arch_init: Start to trace dirty pages of SVM
Date: Thu, 21 May 2015 16:13:04 +0800

we will use this dirty bitmap together with VM's cache RAM dirty bitmap
to decide which page in cache should be flushed into VM's RAM.

Signed-off-by: zhanghailiang <address@hidden>
---
 arch_init.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch_init.c b/arch_init.c
index 9adf007..693d00e 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -1750,6 +1750,7 @@ static int ram_load(QEMUFile *f, void *opaque, int 
version_id)
 int create_and_init_ram_cache(void)
 {
     RAMBlock *block;
+    int64_t ram_cache_pages = last_ram_offset() >> TARGET_PAGE_BITS;
 
     rcu_read_lock();
     QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
@@ -1761,6 +1762,15 @@ int create_and_init_ram_cache(void)
     }
     rcu_read_unlock();
     ram_cache_enable = true;
+    /*
+    * Start dirty log for slave VM, we will use this dirty bitmap together with
+    * VM's cache RAM dirty bitmap to decide which page in cache should be
+    * flushed into VM's RAM.
+    */
+    migration_bitmap = bitmap_new(ram_cache_pages);
+    migration_dirty_pages = 0;
+    memory_global_dirty_log_start();
+
     return 0;
 
 out_locked:
@@ -1781,6 +1791,12 @@ void release_ram_cache(void)
 
     ram_cache_enable = false;
 
+    if (migration_bitmap) {
+        memory_global_dirty_log_stop();
+        g_free(migration_bitmap);
+        migration_bitmap = NULL;
+    }
+
     rcu_read_lock();
     QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
         if (block->host_cache) {
-- 
1.7.12.4





reply via email to

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