aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-10-17 20:27:15 +0200
committerJuan Quintela <quintela@redhat.com>2012-12-20 23:09:40 +0100
commitece7931817e03a4d946c15716fab5e4f781663c9 (patch)
treef7e999ae846287b4465a5764f5a8f517d52036e0 /arch_init.c
parent6c279db8ee99e64e498447c67c16e987150be96b (diff)
ram: Use memory_region_test_and_clear_dirty
This avoids having to do two walks over the dirty bitmap, once reading the dirty bits, and anthoer cleaning them. Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch_init.c b/arch_init.c
index caac526f2f..9f32ee0124 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -390,13 +390,12 @@ static void migration_bitmap_sync(void)
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) {
- if (memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE,
- DIRTY_MEMORY_MIGRATION)) {
+ if (memory_region_test_and_clear_dirty(block->mr,
+ addr, TARGET_PAGE_SIZE,
+ DIRTY_MEMORY_MIGRATION)) {
migration_bitmap_set_dirty(block->mr, addr);
}
}
- memory_region_reset_dirty(block->mr, 0, block->length,
- DIRTY_MEMORY_MIGRATION);
}
trace_migration_bitmap_sync_end(migration_dirty_pages
- num_dirty_pages_init);