From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0pk-00043g-Vp for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:59:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YW0pe-0002hl-4t for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:59:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YW0pd-0002hS-Sm for qemu-devel@nongnu.org; Thu, 12 Mar 2015 06:59:14 -0400 Date: Thu, 12 Mar 2015 10:59:04 +0000 From: "Dr. David Alan Gilbert" Message-ID: <20150312105904.GG2330@work-vm> References: <1425893258-12524-1-git-send-email-zhang.zhanghailiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1425893258-12524-1-git-send-email-zhang.zhanghailiang@huawei.com> Subject: Re: [Qemu-devel] [PATCH] 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: zhanghailiang Cc: amit.shah@redhat.com, peter.huangpeng@huawei.com, qemu-devel@nongnu.org, quintela@redhat.com * zhanghailiang (zhang.zhanghailiang@huawei.com) wrote: > 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 > --- > 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; Yes, I think Markus had suggested something similar when I did the original fix. Thanks, Reviewed-by: Dr. David Alan Gilbert > > memory_global_dirty_log_start(); > migration_bitmap_sync(); > -- > 1.7.12.4 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK