From cc5abdfa2f4b97c27b9a22e0650265e5de414f31 Mon Sep 17 00:00:00 2001 From: Luo Yifan Date: Fri, 1 Dec 2023 10:28:29 +0800 Subject: [PATCH] migration/ram.c: Remove the qemu_mutex_lock in colo_flush_ram_cache. cherry picked from commit 672159a97ce7c1ca2b97bfef439d7994f79b1c61 The code to acquire bitmap_mutex is added in the commit of "63268c4970a5f126cc9af75f3ccb8057abef5ec0". There is no need to acquire bitmap_mutex in colo_flush_ram_cache(). This is because the colo_flush_ram_cache only be called on the COLO secondary VM, which is the destination side. On the COLO secondary VM, only the COLO thread will touch the bitmap of ram cache. Signed-off-by: Lei Rao Reviewed-by: Zhang Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Signed-off-by: Luo Yifan --- migration/ram.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 862955f5b2..b32254145e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4229,7 +4229,6 @@ void colo_flush_ram_cache(void) unsigned long offset = 0; memory_global_dirty_log_sync(); - qemu_mutex_lock(&ram_state->bitmap_mutex); WITH_RCU_READ_LOCK_GUARD() { RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(ram_state, block); @@ -4265,7 +4264,6 @@ void colo_flush_ram_cache(void) } } trace_colo_flush_ram_cache_end(); - qemu_mutex_unlock(&ram_state->bitmap_mutex); } /** -- Gitee