migration: just pass RAMBlock is enough
PATCH 1/1 migration: just pass RAMBlock is enough
RAMBlock->used_length is always passed to migration_bitmap_sync_range(), which could be retrieved from RAMBlock.
--- migration/ram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
migration/ram.c +4 -5
@@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,return ret; } -static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb, -ram_addr_t length) +static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb) { rs->migration_dirty_pages += -cpu_physical_memory_sync_dirty_bitmap (rb,0 , length, +cpu_physical_memory_sync_dirty_bitmap (rb,0 , rb->used_length, &rs->num_dirty_pages_period); }
@@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)qemu_mutex_lock (&rs->bitmap_mutex);rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (rs, block, block->used_length); +migration_bitmap_sync_range (rs, block); } ram_counters.remaining =ram_bytes_remaining ();rcu_read_unlock ();
@@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)memory_global_dirty_log_sync ();rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (ram_state, block, block->used_length); +migration_bitmap_sync_range (ram_state, block); }rcu_read_unlock ();
Signature · 1 line
2.17.1
Quoted 5 lines · Wei Yang
RAMBlock->used_lengthis always passed tomigration_bitmap_sync_range(), which could be retrieved from RAMBlock.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Wei Yang <[email protected]>
Signature · 1 line
Peter Xu
Quoted 38 lines · Wei Yang
RAMBlock->used_lengthis always passed tomigration_bitmap_sync_range(), which could be retrieved from RAMBlock.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Wei Yang <[email protected]>--- migration/ram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)migration/ram.c +3
-4@@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,return ret; } -static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb, -ram_addr_t length) +static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb) { rs->migration_dirty_pages += -cpu_physical_memory_sync_dirty_bitmap (rb,0 , length, +cpu_physical_memory_sync_dirty_bitmap (rb,0 , rb->used_length, &rs->num_dirty_pages_period); }@@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)qemu_mutex_lock (&rs->bitmap_mutex);rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (rs, block, block->used_length); +migration_bitmap_sync_range (rs, block); } ram_counters.remaining =ram_bytes_remaining ();rcu_read_unlock ();
migration/ram.c static void colo_flush_ram_cache(void) · line 4198
Quoted 8 lines
migration/ram.c +1
-1@@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)memory_global_dirty_log_sync ();rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (ram_state, block, block->used_length); +migration_bitmap_sync_range (ram_state, block); }rcu_read_unlock ();
and in fact we can rename the function to ramblock_sync_dirty_bitmap.
Paolo
Quoted 50 lines · Paolo Bonzini
Quoted 38 lines · Wei Yang
RAMBlock->used_lengthis always passed tomigration_bitmap_sync_range(), which could be retrieved from RAMBlock.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Wei Yang <[email protected]>--- migration/ram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)migration/ram.c +3
-4@@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,return ret; } -static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb, -ram_addr_t length) +static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb) { rs->migration_dirty_pages += -cpu_physical_memory_sync_dirty_bitmap (rb,0 , length, +cpu_physical_memory_sync_dirty_bitmap (rb,0 , rb->used_length, &rs->num_dirty_pages_period); }@@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)qemu_mutex_lock (&rs->bitmap_mutex);rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (rs, block, block->used_length); +migration_bitmap_sync_range (rs, block); } ram_counters.remaining =ram_bytes_remaining ();rcu_read_unlock ();migration/ram.c static void colo_flush_ram_cache(void) · line 4198
Quoted 8 lines
migration/ram.c +1
-1@@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)memory_global_dirty_log_sync ();rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (ram_state, block, block->used_length); +migration_bitmap_sync_range (ram_state, block); }rcu_read_unlock ();Reviewed-by Paolo Bonzini <[email protected]>
Quoted 1 line
and in fact we can rename the function to
ramblock_sync_dirty_bitmap.
Sounds reasonable. Let me improve it.
Quoted 2 lines
Paolo
Signature · 2 lines
Wei Yang Help you, Help me
Quoted 5 lines · * Wei Yang ([email protected]) wrote:
RAMBlock->used_lengthis always passed tomigration_bitmap_sync_range(), which could be retrieved from RAMBlock.Suggested-by Paolo Bonzini <[email protected]>Signed-off-by Wei Yang <[email protected]>
Queued
Quoted 44 lines
--- migration/ram.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)migration/ram.c +4
-5@@ -1669,11 +1669,10 @@ static inline bool migration_bitmap_clear_dirty(RAMState *rs,return ret; } -static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb, -ram_addr_t length) +static void migration_bitmap_sync_range (RAMState *rs,RAMBlock *rb) { rs->migration_dirty_pages += -cpu_physical_memory_sync_dirty_bitmap (rb,0 , length, +cpu_physical_memory_sync_dirty_bitmap (rb,0 , rb->used_length, &rs->num_dirty_pages_period); }@@ -1762,7 +1761,7 @@ static void migration_bitmap_sync(RAMState *rs)qemu_mutex_lock (&rs->bitmap_mutex);rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (rs, block, block->used_length); +migration_bitmap_sync_range (rs, block); } ram_counters.remaining =ram_bytes_remaining ();rcu_read_unlock ();@@ -4193,7 +4192,7 @@ static void colo_flush_ram_cache(void)memory_global_dirty_log_sync ();rcu_read_lock ();RAMBLOCK_FOREACH_NOT_IGNORED (block) { -migration_bitmap_sync_range (ram_state, block, block->used_length); +migration_bitmap_sync_range (ram_state, block); }rcu_read_unlock ();Signature · 1 line
2.17.1
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK