Received: from eggs.gnu.org ([2001:4830:134:3::10]:48249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzF9d-0003i0-2S for qemu-devel@nongnu.org; Thu, 11 Dec 2014 20:36:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XzF9X-0004sG-Up for qemu-devel@nongnu.org; Thu, 11 Dec 2014 20:36:25 -0500 Received: from mga09.intel.com ([134.134.136.24]:11941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzF9X-0004lx-Oc for qemu-devel@nongnu.org; Thu, 11 Dec 2014 20:36:19 -0500 From: Liang Li Date: Fri, 12 Dec 2014 09:29:02 +0800 Message-Id: <1418347746-15829-10-git-send-email-liang.z.li@intel.com> In-Reply-To: <1418347746-15829-1-git-send-email-liang.z.li@intel.com> References: <1418347746-15829-1-git-send-email-liang.z.li@intel.com> Subject: [Qemu-devel] [v3 09/13] migration: Make compression co-work with xbzrle List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: quintela@redhat.com, Liang Li , armbru@redhat.com, lcapitulino@redhat.com, yang.z.zhang@intel.com, dgilbert@redhat.com Now, multiple thread compression can co-work with xbzrle. when xbzrle is on, multiple thread compression will only work at the first round of ram data sync. Signed-off-by: Liang Li Signed-off-by: Yang Zhang --- arch_init.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch_init.c b/arch_init.c index 4109ad7..14bc486 100644 --- a/arch_init.c +++ b/arch_init.c @@ -905,8 +905,11 @@ static int ram_save_compressed_page(QEMUFile *f, RAMBlock* block, * block, and all the pages in last block should have been sent * out, keeping this order is important. */ - if (block != last_sent_block) { - flush_compressed_data(f); + if ((!ram_bulk_stage && migrate_use_xbzrle()) || + block != last_sent_block) { + if (block != last_sent_block) { + flush_compressed_data(f); + } bytes_sent = save_zero_and_xbzrle_page(f, block, offset, last_stage, NULL); if (bytes_sent == -1) { @@ -961,6 +964,12 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage) block = QTAILQ_FIRST(&ram_list.blocks); complete_round = true; ram_bulk_stage = false; + if (migrate_use_xbzrle()) { + /* if xbzrle is on, we terminate the compression thread + * at this point, there is no benefit from muti-thead */ + flush_compressed_data(f); + terminate_compression_threads(); + } } } else { if (migrate_use_compression()) { -- 1.8.3.1