From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXtSq-00049o-5C for qemu-devel@nongnu.org; Tue, 17 Mar 2015 11:31:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXtSl-0004F6-TE for qemu-devel@nongnu.org; Tue, 17 Mar 2015 11:31:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXtSl-0004Dp-Ln for qemu-devel@nongnu.org; Tue, 17 Mar 2015 11:31:23 -0400 From: Juan Quintela Date: Tue, 17 Mar 2015 16:30:30 +0100 Message-Id: <1426606235-7238-9-git-send-email-quintela@redhat.com> In-Reply-To: <1426606235-7238-1-git-send-email-quintela@redhat.com> References: <1426606235-7238-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PULL 08/13] arch_init: Count the total number of pages by using helper function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: zhanghailiang From: zhanghailiang 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 Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Juan Quintela --- arch_init.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/arch_init.c b/arch_init.c index c3f7d3f..fcfa328 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(); -- 2.1.0