All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: qemu-devel@nongnu.org, lvivier@redhat.com, peterx@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/5] ram: Move ZERO_TARGET_PAGE inside XBZRLE
Date: Mon, 5 Jun 2017 12:27:12 +0100	[thread overview]
Message-ID: <20170605112712.GI2109@work-vm> (raw)
In-Reply-To: <20170601220813.30535-3-quintela@redhat.com>

* Juan Quintela (quintela@redhat.com) wrote:
> It was only used by XBZRLE anyways.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

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

> ---
>  migration/ram.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/migration/ram.c b/migration/ram.c
> index e503277..04b55a7 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -66,8 +66,6 @@
>  /* 0x80 is reserved in migration.h start with 0x100 next */
>  #define RAM_SAVE_FLAG_COMPRESS_PAGE    0x100
>  
> -static uint8_t *ZERO_TARGET_PAGE;
> -
>  static inline bool is_zero_range(uint8_t *p, uint64_t size)
>  {
>      return buffer_is_zero(p, size);
> @@ -83,6 +81,8 @@ static struct {
>      /* Cache for XBZRLE, Protected by lock. */
>      PageCache *cache;
>      QemuMutex lock;
> +    /* it will store a page full of zeros */
> +    uint8_t *zero_target_page;
>  } XBZRLE;
>  
>  /* buffer used for XBZRLE decoding */
> @@ -509,7 +509,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_addr_t current_addr)
>  
>      /* We don't care if this fails to allocate a new cache page
>       * as long as it updated an old one */
> -    cache_insert(XBZRLE.cache, current_addr, ZERO_TARGET_PAGE,
> +    cache_insert(XBZRLE.cache, current_addr, XBZRLE.zero_target_page,
>                   rs->bitmap_sync_count);
>  }
>  
> @@ -1453,10 +1453,11 @@ static void ram_migration_cleanup(void *opaque)
>          cache_fini(XBZRLE.cache);
>          g_free(XBZRLE.encoded_buf);
>          g_free(XBZRLE.current_buf);
> -        g_free(ZERO_TARGET_PAGE);
> +        g_free(XBZRLE.zero_target_page);
>          XBZRLE.cache = NULL;
>          XBZRLE.encoded_buf = NULL;
>          XBZRLE.current_buf = NULL;
> +        XBZRLE.zero_target_page = NULL;
>      }
>      XBZRLE_cache_unlock();
>      migration_page_queue_free(rs);
> @@ -1877,7 +1878,7 @@ static int ram_state_init(RAMState *rs)
>  
>      if (migrate_use_xbzrle()) {
>          XBZRLE_cache_lock();
> -        ZERO_TARGET_PAGE = g_malloc0(TARGET_PAGE_SIZE);
> +        XBZRLE.zero_target_page = g_malloc0(TARGET_PAGE_SIZE);
>          XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() /
>                                    TARGET_PAGE_SIZE,
>                                    TARGET_PAGE_SIZE);
> -- 
> 2.9.4
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-06-05 11:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 22:08 [Qemu-devel] [PATCH 0/5] Make RAMState dynamic Juan Quintela
2017-06-01 22:08 ` [Qemu-devel] [PATCH 1/5] ram: Call migration_page_queue_free() at ram_migration_cleanup() Juan Quintela
2017-06-05 11:24   ` Dr. David Alan Gilbert
2017-06-06  7:58   ` Peter Xu
2017-06-01 22:08 ` [Qemu-devel] [PATCH 2/5] ram: Move ZERO_TARGET_PAGE inside XBZRLE Juan Quintela
2017-06-05 11:27   ` Dr. David Alan Gilbert [this message]
2017-06-06  7:59   ` Peter Xu
2017-06-01 22:08 ` [Qemu-devel] [PATCH 3/5] migration: Print statistics about the number of remaining target pages Juan Quintela
2017-06-02 15:15   ` Eric Blake
2017-06-02 16:36     ` Juan Quintela
2017-06-06 17:48     ` Juan Quintela
2017-06-01 22:08 ` [Qemu-devel] [PATCH 4/5] ram: Use MigrationStats for statistics Juan Quintela
2017-06-05 12:34   ` Dr. David Alan Gilbert
2017-06-06  8:05     ` Peter Xu
2017-06-06 17:33       ` Juan Quintela
2017-06-07  3:08         ` Peter Xu
2017-06-01 22:08 ` [Qemu-devel] [PATCH 5/5] ram: Make RAMState dynamic Juan Quintela
2017-06-05 15:00   ` Dr. David Alan Gilbert
2017-06-06  8:16   ` Peter Xu
2017-06-06 17:39     ` 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=20170605112712.GI2109@work-vm \
    --to=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peterx@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 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.