qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, quintela@redhat.com, amit.shah@redhat.com
Cc: jdenemar@redhat.com, liang.z.li@intel.com,
	zhang.zhanghailiang@huawei.com
Subject: [Qemu-devel] [PATCH 5/6] Use qemu_get_buffer_in_place for xbzrle data
Date: Tue, 15 Dec 2015 19:02:49 +0000	[thread overview]
Message-ID: <1450206170-26901-6-git-send-email-dgilbert@redhat.com> (raw)
In-Reply-To: <1450206170-26901-1-git-send-email-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Avoid a data copy (if we're lucky) in the xbzrle code.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/ram.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/migration/ram.c b/migration/ram.c
index 102d1f2..994552c 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -2088,10 +2088,12 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
 {
     unsigned int xh_len;
     int xh_flags;
+    uint8_t *loaded_data;
 
     if (!xbzrle_decoded_buf) {
         xbzrle_decoded_buf = g_malloc(TARGET_PAGE_SIZE);
     }
+    loaded_data = xbzrle_decoded_buf;
 
     /* extract RLE header */
     xh_flags = qemu_get_byte(f);
@@ -2107,10 +2109,10 @@ static int load_xbzrle(QEMUFile *f, ram_addr_t addr, void *host)
         return -1;
     }
     /* load data and decode */
-    qemu_get_buffer(f, xbzrle_decoded_buf, xh_len);
+    qemu_get_buffer_in_place(f, &loaded_data, xh_len);
 
     /* decode RLE */
-    if (xbzrle_decode_buffer(xbzrle_decoded_buf, xh_len, host,
+    if (xbzrle_decode_buffer(loaded_data, xh_len, host,
                              TARGET_PAGE_SIZE) == -1) {
         error_report("Failed to load XBZRLE page - decode error!");
         return -1;
-- 
2.5.0

  parent reply	other threads:[~2015-12-15 19:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15 19:02 [Qemu-devel] [PATCH 0/6] Migration: Small fixes and improvements Dr. David Alan Gilbert (git)
2015-12-15 19:02 ` [Qemu-devel] [PATCH 1/6] migration: Export migrate_set_state() Dr. David Alan Gilbert (git)
2015-12-16 10:25   ` Juan Quintela
2015-12-15 19:02 ` [Qemu-devel] [PATCH 2/6] migration: Add state records for migration incoming Dr. David Alan Gilbert (git)
2015-12-16 10:26   ` Juan Quintela
2015-12-15 19:02 ` [Qemu-devel] [PATCH 3/6] Postcopy: Send events/change state on incoming side Dr. David Alan Gilbert (git)
2015-12-16  5:10   ` Hailiang Zhang
2015-12-16 10:27   ` Juan Quintela
2015-12-15 19:02 ` [Qemu-devel] [PATCH 4/6] Migration: Emit event at start of pass Dr. David Alan Gilbert (git)
2015-12-15 21:07   ` Eric Blake
2015-12-16 10:01     ` Dr. David Alan Gilbert
2015-12-16 16:40       ` Eric Blake
2015-12-16 10:29   ` Juan Quintela
2015-12-15 19:02 ` Dr. David Alan Gilbert (git) [this message]
2015-12-16 10:37   ` [Qemu-devel] [PATCH 5/6] Use qemu_get_buffer_in_place for xbzrle data Juan Quintela
2015-12-15 19:02 ` [Qemu-devel] [PATCH 6/6] multithread decompression: Avoid one copy Dr. David Alan Gilbert (git)
2015-12-16  1:12   ` Li, Liang Z
2015-12-16 10:35   ` 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=1450206170-26901-6-git-send-email-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=liang.z.li@intel.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 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).