All of lore.kernel.org
 help / color / mirror / Atom feed
From: <arei.gonglei@huawei.com>
To: qemu-devel@nongnu.org
Cc: ChenLiang <chenliang88@huawei.com>,
	weidong.huang@huawei.com, quintela@redhat.com,
	dgilbert@redhat.com, owasserm@redhat.com,
	Gonglei <arei.gonglei@huawei.com>,
	pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH v5 09/10] migration: optimize xbzrle by reducing data copy
Date: Fri, 4 Apr 2014 17:58:01 +0800	[thread overview]
Message-ID: <1396605482-8720-10-git-send-email-arei.gonglei@huawei.com> (raw)
In-Reply-To: <1396605482-8720-1-git-send-email-arei.gonglei@huawei.com>

From: ChenLiang <chenliang88@huawei.com>

Reducing data copy can reduce cpu overhead.

Signed-off-by: ChenLiang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 arch_init.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch_init.c b/arch_init.c
index 84a4bd3..94b62e2 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -373,11 +373,8 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t **current_data,
 
     prev_cached_page = get_cached_data(XBZRLE.cache, current_addr);
 
-    /* save current buffer into memory */
-    memcpy(XBZRLE.current_buf, *current_data, TARGET_PAGE_SIZE);
-
     /* XBZRLE encoding (if there is no overflow) */
-    encoded_len = xbzrle_encode_buffer(prev_cached_page, XBZRLE.current_buf,
+    encoded_len = xbzrle_encode_buffer(prev_cached_page, *current_data,
                                        TARGET_PAGE_SIZE, XBZRLE.encoded_buf,
                                        TARGET_PAGE_SIZE);
     if (encoded_len == 0) {
@@ -396,7 +393,8 @@ 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);
+        xbzrle_decode_buffer(XBZRLE.encoded_buf, encoded_len, prev_cached_page,
+                             TARGET_PAGE_SIZE);
     }
 
     /* Send XBZRLE based compressed page */
-- 
1.7.12.4

  parent reply	other threads:[~2014-04-04  9:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04  9:57 [Qemu-devel] [PATCH v5 00/10] migration: Optimizate the xbzrle and fix one corruption issue arei.gonglei
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 01/10] XBZRLE: Fix one XBZRLE corruption issues arei.gonglei
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 02/10] migration: Add counts of updating the dirty bitmap arei.gonglei
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 03/10] migration: expose the bitmap_sync_count to the end arei.gonglei
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 04/10] migration: expose xbzrle cache miss rate arei.gonglei
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 05/10] XBZRLE: optimize XBZRLE to decrease the cache misses arei.gonglei
2014-05-01 14:24   ` Eric Blake
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 06/10] XBZRLE: rebuild the cache_is_cached function arei.gonglei
2014-05-01 14:29   ` Eric Blake
2014-04-04  9:57 ` [Qemu-devel] [PATCH v5 07/10] xbzrle: don't check the value in the vm ram repeatedly arei.gonglei
2014-04-04 19:50   ` Dr. David Alan Gilbert
2014-04-04  9:58 ` [Qemu-devel] [PATCH v5 08/10] xbzrle: check 8 bytes at a time after an concurrency scene arei.gonglei
2014-04-04 19:52   ` Dr. David Alan Gilbert
2014-04-05  2:39     ` 陈梁
2014-04-04  9:58 ` arei.gonglei [this message]
2014-04-04 19:59   ` [Qemu-devel] [PATCH v5 09/10] migration: optimize xbzrle by reducing data copy Dr. David Alan Gilbert
2014-04-04  9:58 ` [Qemu-devel] [PATCH v5 10/10] migration: clear the dead code arei.gonglei
2014-04-04 17:16 ` [Qemu-devel] [PATCH v5 00/10] migration: Optimizate the xbzrle and fix one corruption issue Dr. David Alan Gilbert
2014-04-04 17:24 ` [Qemu-devel] For 2.0? " Eric Blake
2014-04-04 17:40   ` Dr. David Alan Gilbert

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=1396605482-8720-10-git-send-email-arei.gonglei@huawei.com \
    --to=arei.gonglei@huawei.com \
    --cc=chenliang88@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=weidong.huang@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.