Skip to content

Commit

Permalink
arch_init: Count the total number of pages by using helper function
Browse files Browse the repository at this point in the history
There is already a helper function ram_bytes_total(), we can use it to
help counting the total number of pages used by ram blocks.

Signed-off-by: zhanghailiang <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
  • Loading branch information
colo-ft authored and Juan Quintela committed Mar 17, 2015
1 parent 4debb5f commit f54a235
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions arch_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,13 +895,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
* Count the total number of pages used by ram blocks not including any
* gaps due to alignment or unplugs.
*/
migration_dirty_pages = 0;
QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
uint64_t block_pages;

block_pages = block->used_length >> TARGET_PAGE_BITS;
migration_dirty_pages += block_pages;
}
migration_dirty_pages = ram_bytes_total() >> TARGET_PAGE_BITS;

memory_global_dirty_log_start();
migration_bitmap_sync();
Expand Down

0 comments on commit f54a235

Please sign in to comment.