aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorzhanghailiang <zhang.zhanghailiang@huawei.com>2020-02-24 14:54:11 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2020-03-13 09:36:30 +0000
commit8af66371ed8e86c7caea9b814dcee23e8ba08f79 (patch)
tree5c05b9b7c9d1cbdeaadf3e0da47b9c011aa4f4eb /migration
parent0393031a16735835a441b6d6e0495a1bd14adb90 (diff)
downloadqemu-8af66371ed8e86c7caea9b814dcee23e8ba08f79.zip
qemu-8af66371ed8e86c7caea9b814dcee23e8ba08f79.tar.gz
qemu-8af66371ed8e86c7caea9b814dcee23e8ba08f79.tar.bz2
ram/colo: only record bitmap of dirty pages in COLO stage
It is only need to record bitmap of dirty pages while goes into COLO stage. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Message-Id: <20200224065414.36524-6-zhang.zhanghailiang@huawei.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 31f4a9d..c12cfdb 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2742,7 +2742,7 @@ static inline void *host_from_ram_block_offset(RAMBlock *block,
}
static inline void *colo_cache_from_block_offset(RAMBlock *block,
- ram_addr_t offset)
+ ram_addr_t offset, bool record_bitmap)
{
if (!offset_in_ramblock(block, offset)) {
return NULL;
@@ -2758,7 +2758,8 @@ static inline void *colo_cache_from_block_offset(RAMBlock *block,
* It help us to decide which pages in ram cache should be flushed
* into VM's RAM later.
*/
- if (!test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) {
+ if (record_bitmap &&
+ !test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) {
ram_state->migration_dirty_pages++;
}
return block->colo_cache + offset;
@@ -3416,13 +3417,13 @@ static int ram_load_precopy(QEMUFile *f)
if (migration_incoming_colo_enabled()) {
if (migration_incoming_in_colo_state()) {
/* In COLO stage, put all pages into cache temporarily */
- host = colo_cache_from_block_offset(block, addr);
+ host = colo_cache_from_block_offset(block, addr, true);
} else {
/*
* In migration stage but before COLO stage,
* Put all pages into both cache and SVM's memory.
*/
- host_bak = colo_cache_from_block_offset(block, addr);
+ host_bak = colo_cache_from_block_offset(block, addr, false);
}
}
if (!host) {