arch_init: Count the total number of pages by using helper function

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 <zhang.zhanghailiang@huawei.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
zhanghailiang 2015-03-09 17:27:38 +08:00 committed by Juan Quintela
parent 4debb5f553
commit f54a235f9b
1 changed files with 1 additions and 7 deletions

View File

@ -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 * Count the total number of pages used by ram blocks not including any
* gaps due to alignment or unplugs. * gaps due to alignment or unplugs.
*/ */
migration_dirty_pages = 0; migration_dirty_pages = ram_bytes_total() >> TARGET_PAGE_BITS;
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;
}
memory_global_dirty_log_start(); memory_global_dirty_log_start();
migration_bitmap_sync(); migration_bitmap_sync();