aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorzhanghailiang <zhang.zhanghailiang@huawei.com>2015-03-09 17:27:38 +0800
committerJuan Quintela <quintela@redhat.com>2015-03-17 15:20:37 +0100
commitf54a235f9b15ae59d70b40630417d8aaa88bc4ec (patch)
treef6a67be405aea6ae3c1b4f2458ca61d121e7c3f6 /arch_init.c
parent4debb5f553d816bf1f2d86bb61e833e79010cb3d (diff)
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>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/arch_init.c b/arch_init.c
index c3f7d3f56d..fcfa32828d 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -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();