qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] arch_init: Count the total number of pages by using helper function
@ 2015-03-09  9:27 zhanghailiang
  2015-03-12 10:59 ` Dr. David Alan Gilbert
  2015-03-17 13:52 ` Juan Quintela
  0 siblings, 2 replies; 3+ messages in thread
From: zhanghailiang @ 2015-03-09  9:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, zhanghailiang, peter.huangpeng, dgilbert, quintela

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>
---
 arch_init.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 691b5e2..b22e38e 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -845,13 +845,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();
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-17 13:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09  9:27 [Qemu-devel] [PATCH] arch_init: Count the total number of pages by using helper function zhanghailiang
2015-03-12 10:59 ` Dr. David Alan Gilbert
2015-03-17 13:52 ` Juan Quintela

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).