aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-09-22 16:09:08 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:27:19 +0200
commitadaad61c3c8efb5b4f21ad70c6e141215fdbb304 (patch)
treec441e4e316d770ecd7fc1b8ba24f015debb52b55 /memory.c
parent9a54635dcb51a3fcf7507af630168f514a8cd4e7 (diff)
memory: optimize memory_global_dirty_log_sync
Only return a nonzero dirty_log_mask for RAM/ROM memory regions. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/memory.c b/memory.c
index 1507878d51..c857722f86 100644
--- a/memory.c
+++ b/memory.c
@@ -1499,7 +1499,7 @@ bool memory_region_is_skip_dump(MemoryRegion *mr)
uint8_t memory_region_get_dirty_log_mask(MemoryRegion *mr)
{
uint8_t mask = mr->dirty_log_mask;
- if (global_dirty_log) {
+ if (global_dirty_log && mr->ram_block) {
mask |= (1 << DIRTY_MEMORY_MIGRATION);
}
return mask;
@@ -2171,8 +2171,10 @@ void memory_global_dirty_log_sync(void)
as = listener->address_space;
view = address_space_get_flatview(as);
FOR_EACH_FLAT_RANGE(fr, view) {
- MemoryRegionSection mrs = section_from_flat_range(fr, as);
- listener->log_sync(listener, &mrs);
+ if (fr->dirty_log_mask) {
+ MemoryRegionSection mrs = section_from_flat_range(fr, as);
+ listener->log_sync(listener, &mrs);
+ }
}
flatview_unref(view);
}