From patchwork Fri Dec 12 01:29:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Liang Z" X-Patchwork-Id: 420333 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5315B14009B for ; Fri, 12 Dec 2014 12:42:44 +1100 (AEDT) Received: from localhost ([::1]:55043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XzFFi-0004xo-FT for incoming@patchwork.ozlabs.org; Thu, 11 Dec 2014 20:42:42 -0500 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 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 11 Dec 2014 17:34:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,691,1406617200"; d="scan'208";a="497578819" Received: from lil.sh.intel.com (HELO localhost) ([10.239.36.68]) by orsmga003.jf.intel.com with ESMTP; 11 Dec 2014 17:32:24 -0800 From: Liang Li To: qemu-devel@nongnu.org Date: Fri, 12 Dec 2014 09:29:02 +0800 Message-Id: <1418347746-15829-10-git-send-email-liang.z.li@intel.com> X-Mailer: git-send-email 1.9.1 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> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.24 Cc: quintela@redhat.com, Liang Li , armbru@redhat.com, lcapitulino@redhat.com, yang.z.zhang@intel.com, dgilbert@redhat.com Subject: [Qemu-devel] [v3 09/13] migration: Make compression co-work with xbzrle X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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()) {