From: Orit Wasserman <owasserm@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/4] ram: remove xbrle last_stage optimization
Date: Mon, 21 Jan 2013 12:11:26 +0200 [thread overview]
Message-ID: <50FD144E.60101@redhat.com> (raw)
In-Reply-To: <1358510033-17268-3-git-send-email-quintela@redhat.com>
Juan,
Why not add a migration_is_last_stage (similar to migration_is_xbzrle) function and leave the optimization
Regards,
Orit
On 01/18/2013 01:53 PM, Juan Quintela wrote:
> We need to remove it to be able to return from complete to iterative
> phases of migration.
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
> arch_init.c | 24 +++++++++---------------
> 1 file changed, 9 insertions(+), 15 deletions(-)
>
> diff --git a/arch_init.c b/arch_init.c
> index 2792b76..9f7d44d 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -286,16 +286,14 @@ static size_t save_block_hdr(QEMUFile *f, RAMBlock *block, ram_addr_t offset,
>
> static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data,
> ram_addr_t current_addr, RAMBlock *block,
> - ram_addr_t offset, int cont, bool last_stage)
> + ram_addr_t offset, int cont)
> {
> int encoded_len = 0, bytes_sent = -1;
> uint8_t *prev_cached_page;
>
> if (!cache_is_cached(XBZRLE.cache, current_addr)) {
> - if (!last_stage) {
> - cache_insert(XBZRLE.cache, current_addr,
> - g_memdup(current_data, TARGET_PAGE_SIZE));
> - }
> + cache_insert(XBZRLE.cache, current_addr,
> + g_memdup(current_data, TARGET_PAGE_SIZE));
> acct_info.xbzrle_cache_miss++;
> return -1;
> }
> @@ -321,9 +319,7 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data,
> }
>
> /* we need to update the data in the cache, in order to get the same data */
> - if (!last_stage) {
> - memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
> - }
> + memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
>
> /* Send XBZRLE based compressed page */
> bytes_sent = save_block_hdr(f, block, offset, cont, RAM_SAVE_FLAG_XBZRLE);
> @@ -426,7 +422,7 @@ static void migration_bitmap_sync(void)
> * 0 means no dirty pages
> */
>
> -static int ram_save_block(QEMUFile *f, bool last_stage)
> +static int ram_save_block(QEMUFile *f)
> {
> RAMBlock *block = last_seen_block;
> ram_addr_t offset = last_offset;
> @@ -470,10 +466,8 @@ static int ram_save_block(QEMUFile *f, bool last_stage)
> } else if (migrate_use_xbzrle()) {
> current_addr = block->offset + offset;
> bytes_sent = save_xbzrle_page(f, p, current_addr, block,
> - offset, cont, last_stage);
> - if (!last_stage) {
> - p = get_cached_data(XBZRLE.cache, current_addr);
> - }
> + offset, cont);
> + p = get_cached_data(XBZRLE.cache, current_addr);
> }
>
> /* XBZRLE overflow or normal page */
> @@ -621,7 +615,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque, uint64_t free_space)
> i = 0;
> /* We need space for at least one page and end of section marker */
> while (free_space > MAX_PAGE_SIZE + 8) {
> - int bytes_sent = ram_save_block(f, false);
> + int bytes_sent = ram_save_block(f);
> /* no more blocks to sent */
> if (bytes_sent == 0) {
> break;
> @@ -665,7 +659,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
> while (true) {
> int bytes_sent;
>
> - bytes_sent = ram_save_block(f, true);
> + bytes_sent = ram_save_block(f);
> /* no more blocks to sent */
> if (bytes_sent == 0) {
> break;
>
next prev parent reply other threads:[~2013-01-21 10:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 11:53 [Qemu-devel] [RFC 0/4] migration.experimental queue Juan Quintela
2013-01-18 11:53 ` [Qemu-devel] [PATCH 1/4] ram: add free_space parameter to save_live functions Juan Quintela
2013-01-21 9:59 ` Orit Wasserman
2013-01-18 11:53 ` [Qemu-devel] [PATCH 2/4] ram: remove xbrle last_stage optimization Juan Quintela
2013-01-21 10:11 ` Orit Wasserman [this message]
2013-01-18 11:53 ` [Qemu-devel] [PATCH 3/4] ram: reuse ram_save_iterate() for the complete stage Juan Quintela
2013-01-21 10:17 ` Orit Wasserman
2013-01-21 10:31 ` Paolo Bonzini
2013-01-18 11:53 ` [Qemu-devel] [PATCH 4/4] migration: print times for end phase Juan Quintela
2013-01-21 10:19 ` Orit Wasserman
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=50FD144E.60101@redhat.com \
--to=owasserm@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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 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).