All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>
Cc: amit.shah@redhat.com, peter.huangpeng@huawei.com,
	qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH] arch_init: Count the total number of pages by using helper function
Date: Thu, 12 Mar 2015 10:59:04 +0000	[thread overview]
Message-ID: <20150312105904.GG2330@work-vm> (raw)
In-Reply-To: <1425893258-12524-1-git-send-email-zhang.zhanghailiang@huawei.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 <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;

Yes, I think Markus had suggested something similar when I did the
original fix.

Thanks,

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

>  
>      memory_global_dirty_log_start();
>      migration_bitmap_sync();
> -- 
> 1.7.12.4
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-03-12 10:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-03-17 13:52 ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150312105904.GG2330@work-vm \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.