From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfo7Y-0002rf-Cv for qemu-devel@nongnu.org; Wed, 08 Apr 2015 07:26:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfo7V-00063t-5S for qemu-devel@nongnu.org; Wed, 08 Apr 2015 07:26:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfo7U-00063l-T4 for qemu-devel@nongnu.org; Wed, 08 Apr 2015 07:26:09 -0400 From: Juan Quintela In-Reply-To: <1428474011-30797-10-git-send-email-liang.z.li@intel.com> (Liang Li's message of "Wed, 8 Apr 2015 14:20:06 +0800") References: <1428474011-30797-1-git-send-email-liang.z.li@intel.com> <1428474011-30797-10-git-send-email-liang.z.li@intel.com> Date: Wed, 08 Apr 2015 13:26:05 +0200 Message-ID: <87egnun9o2.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [v7 09/14] migration: Make compression co-work with xbzrle Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liang Li Cc: qemu-devel@nongnu.org, armbru@redhat.com, lcapitulino@redhat.com, Yang Zhang , amit.shah@redhat.com, dgilbert@redhat.com Liang Li wrote: > 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 > Reviewed-by: Dr.David Alan Gilbert Reviewed-by: Juan Quintela > /* The empty QEMUFileOps will be used by file in CompressParam */ > static const QEMUFileOps empty_ops = { }; > +static bool compression_switch; > + > static DecompressParam *decomp_param; > static QemuThread *decompress_threads; > static uint8_t *compressed_data_buf; > @@ -436,6 +438,7 @@ void migrate_compress_threads_create(void) > if (!migrate_use_compression()) { > return; > } > + compression_switch = true; > thread_count = migrate_compress_threads(); > compress_threads = g_new0(QemuThread, thread_count); > comp_param = g_new0(CompressParam, thread_count); > @@ -1059,9 +1062,16 @@ static int ram_find_and_save_block(QEMUFile *f, bool last_stage, > block = QLIST_FIRST_RCU(&ram_list.blocks); > complete_round = true; > ram_bulk_stage = false; > + if (migrate_use_xbzrle()) { > + /* If xbzrle is on, stop using the data compression at this > + * point. In theory, xbzrle can do better than compression. > + */ > + flush_compressed_data(f); > + compression_switch = false; > + } I still think that it should be better: a- don't mix them (or) b- if we mix them, just use compression always that we sent whole pages. if xbzrle is not able to compress a page, use compression after putting the page on the cache. i.e. try first to set through xbzrle, and if that don't work, use compression if possible (after zecond iteration, of course).) But as you are the one doing the code.... Later, Juan. PD. Yes, it can be changed later.