Revisão | 8af66371ed8e86c7caea9b814dcee23e8ba08f79 (tree) |
---|---|
Hora | 2020-03-13 18:36:30 |
Autor | zhanghailiang <zhang.zhanghailiang@huaw...> |
Commiter | Dr. David Alan Gilbert |
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>
@@ -2742,7 +2742,7 @@ static inline void *host_from_ram_block_offset(RAMBlock *block, | ||
2742 | 2742 | } |
2743 | 2743 | |
2744 | 2744 | static inline void *colo_cache_from_block_offset(RAMBlock *block, |
2745 | - ram_addr_t offset) | |
2745 | + ram_addr_t offset, bool record_bitmap) | |
2746 | 2746 | { |
2747 | 2747 | if (!offset_in_ramblock(block, offset)) { |
2748 | 2748 | return NULL; |
@@ -2758,7 +2758,8 @@ static inline void *colo_cache_from_block_offset(RAMBlock *block, | ||
2758 | 2758 | * It help us to decide which pages in ram cache should be flushed |
2759 | 2759 | * into VM's RAM later. |
2760 | 2760 | */ |
2761 | - if (!test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) { | |
2761 | + if (record_bitmap && | |
2762 | + !test_and_set_bit(offset >> TARGET_PAGE_BITS, block->bmap)) { | |
2762 | 2763 | ram_state->migration_dirty_pages++; |
2763 | 2764 | } |
2764 | 2765 | return block->colo_cache + offset; |
@@ -3416,13 +3417,13 @@ static int ram_load_precopy(QEMUFile *f) | ||
3416 | 3417 | if (migration_incoming_colo_enabled()) { |
3417 | 3418 | if (migration_incoming_in_colo_state()) { |
3418 | 3419 | /* In COLO stage, put all pages into cache temporarily */ |
3419 | - host = colo_cache_from_block_offset(block, addr); | |
3420 | + host = colo_cache_from_block_offset(block, addr, true); | |
3420 | 3421 | } else { |
3421 | 3422 | /* |
3422 | 3423 | * In migration stage but before COLO stage, |
3423 | 3424 | * Put all pages into both cache and SVM's memory. |
3424 | 3425 | */ |
3425 | - host_bak = colo_cache_from_block_offset(block, addr); | |
3426 | + host_bak = colo_cache_from_block_offset(block, addr, false); | |
3426 | 3427 | } |
3427 | 3428 | } |
3428 | 3429 | if (!host) { |