summaryrefslogtreecommitdiffstats
path: root/include/exec
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-03-25 15:21:39 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2015-06-05 17:10:00 +0200
commite87f7778b64d4a6a78e16c288c7fdc6c15317d5f (patch)
treed246cf453fbddd2831d628f4217a34e65f9274fc /include/exec
parent72b47e79cef36ed6ffc718f10e21001d7ec2a66f (diff)
downloadhqemu-e87f7778b64d4a6a78e16c288c7fdc6c15317d5f.zip
hqemu-e87f7778b64d4a6a78e16c288c7fdc6c15317d5f.tar.gz
exec: only check relevant bitmaps for cleanliness
Most of the time, not all bitmaps have to be marked as dirty; do not do anything if the interesting ones are already dirty. Previously, any clean bitmap would have cause all the bitmaps to be marked dirty. In fact, unless running TCG most of the time bitmap operations need not be done at all, because memory_region_is_logging returns zero. In this case, skip the call to cpu_physical_memory_range_includes_clean altogether as well. With this patch, cpu_physical_memory_set_dirty_range is called unconditionally, so there need not be anymore a separate call to xen_modified_memory. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/exec')
-rw-r--r--include/exec/ram_addr.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index c221bd7..3e42b4f 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -89,14 +89,25 @@ static inline bool cpu_physical_memory_is_clean(ram_addr_t addr)
return !(vga && code && migration);
}
-static inline bool cpu_physical_memory_range_includes_clean(ram_addr_t start,
- ram_addr_t length)
+static inline uint8_t cpu_physical_memory_range_includes_clean(ram_addr_t start,
+ ram_addr_t length,
+ uint8_t mask)
{
- bool vga = !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_VGA);
- bool code = !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_CODE);
- bool migration =
- !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_MIGRATION);
- return vga || code || migration;
+ uint8_t ret = 0;
+
+ if (mask & (1 << DIRTY_MEMORY_VGA) &&
+ !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_VGA)) {
+ ret |= (1 << DIRTY_MEMORY_VGA);
+ }
+ if (mask & (1 << DIRTY_MEMORY_CODE) &&
+ !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_CODE)) {
+ ret |= (1 << DIRTY_MEMORY_CODE);
+ }
+ if (mask & (1 << DIRTY_MEMORY_MIGRATION) &&
+ !cpu_physical_memory_all_dirty(start, length, DIRTY_MEMORY_MIGRATION)) {
+ ret |= (1 << DIRTY_MEMORY_MIGRATION);
+ }
+ return ret;
}
static inline void cpu_physical_memory_set_dirty_flag(ram_addr_t addr,
OpenPOWER on IntegriCloud