From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWAGg-0001tZ-34 for qemu-devel@nongnu.org; Fri, 04 Apr 2014 15:59:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWAGa-0000qg-VR for qemu-devel@nongnu.org; Fri, 04 Apr 2014 15:59:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWAGa-0000qW-NL for qemu-devel@nongnu.org; Fri, 04 Apr 2014 15:59:08 -0400 Date: Fri, 4 Apr 2014 20:59:01 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20140404195900.GC2492@work-vm> References: <1396605482-8720-1-git-send-email-arei.gonglei@huawei.com> <1396605482-8720-10-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1396605482-8720-10-git-send-email-arei.gonglei@huawei.com> Subject: Re: [Qemu-devel] [PATCH v5 09/10] migration: optimize xbzrle by reducing data copy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: ChenLiang , weidong.huang@huawei.com, quintela@redhat.com, qemu-devel@nongnu.org, pbonzini@redhat.com * arei.gonglei@huawei.com (arei.gonglei@huawei.com) wrote: > From: ChenLiang > > Reducing data copy can reduce cpu overhead. > > Signed-off-by: ChenLiang > Signed-off-by: Gonglei Yes, with the previous patches that's now correct. Reviewed-by: Dr. David Alan Gilbert > --- > 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 > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK