From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0Xgc-0000Fl-5g for qemu-devel@nongnu.org; Tue, 18 Apr 2017 14:17:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0XgY-0001Ot-56 for qemu-devel@nongnu.org; Tue, 18 Apr 2017 14:17:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39982) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d0XgX-0001Oc-T2 for qemu-devel@nongnu.org; Tue, 18 Apr 2017 14:17:06 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EEB9F64D86 for ; Tue, 18 Apr 2017 18:17:04 +0000 (UTC) From: Juan Quintela In-Reply-To: <20170411041438.GE2313@pxdev.xzpeter.org> (Peter Xu's message of "Tue, 11 Apr 2017 12:14:38 +0800") References: <20170406130913.2232-1-quintela@redhat.com> <20170406130913.2232-41-quintela@redhat.com> <20170411041438.GE2313@pxdev.xzpeter.org> Reply-To: quintela@redhat.com Date: Tue, 18 Apr 2017 20:17:01 +0200 Message-ID: <871sspins2.fsf@secure.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 40/54] ram: Remove compression_switch and inline its logic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu Cc: qemu-devel@nongnu.org, dgilbert@redhat.com Peter Xu wrote: > On Thu, Apr 06, 2017 at 03:08:59PM +0200, Juan Quintela wrote: >> We can calculate its value, so not create a varible for it. >> >> Signed-off-by: Juan Quintela >> >> -- >> >> After Peter and Dave review, I dropped the variable and just inlined >> the condition. >> >> Later, Juan. >> >> Signed-off-by: Juan Quintela >> --- >> migration/ram.c | 12 ++++++++---- >> 1 file changed, 8 insertions(+), 4 deletions(-) >> >> diff --git a/migration/ram.c b/migration/ram.c >> index 14d54fd..5dfc9bd 100644 >> --- a/migration/ram.c >> +++ b/migration/ram.c >> @@ -336,7 +336,6 @@ static QemuCond comp_done_cond; >> /* 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 QemuMutex decomp_done_lock; >> @@ -420,7 +419,6 @@ 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); >> @@ -1092,7 +1090,6 @@ static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, >> * point. In theory, xbzrle can do better than compression. >> */ >> flush_compressed_data(rs); >> - compression_switch = false; >> } >> } >> /* Didn't find anything this time, but try again on the new block */ >> @@ -1326,7 +1323,14 @@ static int ram_save_target_page(RAMState *rs, MigrationState *ms, >> /* Check the pages is dirty and if it is send it */ >> if (migration_bitmap_clear_dirty(rs, dirty_ram_abs)) { >> unsigned long *unsentmap; >> - if (compression_switch && migrate_use_compression()) { >> + /* >> + * If xbzrle is on, stop using the data compression after first >> + * round of migration even if compression is enabled. In theory, >> + * xbzrle can do better than compression. >> + */ >> + >> + if (migrate_use_compression()) > ^ is this a superfluous ")"? > fix compliation. good catch. I think that I have fixed that in a later patch, as this worked O:-) >> + && (rs->ram_bulk_stage || !migrate_use_xbzrle()) { I need to put it here. Later, Juan.