aboutsummaryrefslogtreecommitdiff
path: root/exec-obsolete.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-06-22 15:21:07 +0200
committerJuan Quintela <quintela@redhat.com>2012-06-29 13:31:07 +0200
commit45f33f01f359d6028ec4b4018a2bf2ff53806e11 (patch)
tree1349fd5ada2a86bfa51df5fd8c9c9da5abbe95ea /exec-obsolete.h
parent1720aeee72888f80b974c33b6eb39922a0bea992 (diff)
Maintain the number of dirty pages
Calculate the number of dirty pages takes a lot on hosts with lots of memory. Just maintain how many pages are dirty. Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'exec-obsolete.h')
-rw-r--r--exec-obsolete.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/exec-obsolete.h b/exec-obsolete.h
index f8ffce607a..c09925610d 100644
--- a/exec-obsolete.h
+++ b/exec-obsolete.h
@@ -74,6 +74,11 @@ static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
int dirty_flags)
{
+ if ((dirty_flags & MIGRATION_DIRTY_FLAG) &&
+ !cpu_physical_memory_get_dirty(addr, TARGET_PAGE_SIZE,
+ MIGRATION_DIRTY_FLAG)) {
+ ram_list.dirty_pages++;
+ }
return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] |= dirty_flags;
}
@@ -87,6 +92,11 @@ static inline int cpu_physical_memory_clear_dirty_flags(ram_addr_t addr,
{
int mask = ~dirty_flags;
+ if ((dirty_flags & MIGRATION_DIRTY_FLAG) &&
+ cpu_physical_memory_get_dirty(addr, TARGET_PAGE_SIZE,
+ MIGRATION_DIRTY_FLAG)) {
+ ram_list.dirty_pages--;
+ }
return ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] &= mask;
}