From patchwork Thu Sep 6 07:01:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10589947 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36DEB13BB for ; Thu, 6 Sep 2018 07:04:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FDED2A592 for ; Thu, 6 Sep 2018 07:04:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22F4F2A597; Thu, 6 Sep 2018 07:04:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C6D3C2A592 for ; Thu, 6 Sep 2018 07:04:40 +0000 (UTC) Received: from localhost ([::1]:59873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxoLI-00054w-3S for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Sep 2018 03:04:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxoI8-0001R8-Uk for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxoI8-0008Fh-4V for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:24 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:46850) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fxoI7-0008EE-F4 for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:24 -0400 Received: by mail-pl1-x62a.google.com with SMTP id t19-v6so4509586ply.13 for ; Thu, 06 Sep 2018 00:01:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x/yvF6rLcefKp4F7fvRvQvJ/7u8JYj73jUiGjQmP4Es=; b=ka0+MefJgOuByr+8xAauEiWM+Y10aRNyGKhOpj01m6CrjLtqlBfd+oMCv0/SxFBVkS wAtCAznapZi8qQKYc+2NkbczDdPUNdNy+aFYWkeozftaUzKfGdMGOlDORePbbXD25qnG Zzr1X9OAA2q8xJPJ2HQsODxO75L/W9rHGY1n6qj9HK00PA5ln316pinsGfMUqV0ayXAx AJdVLzNm8u3y+/vy8V61HIiBCVV4f2IP8nfVrB1ghoIdoQsR9EE7ecF/3ZQ2kzwlTH2f VY5rqFh2Be7Ug3YBJ5+/RTd0dWaw0qth3hn/u29Bhvfsc8XyCXhHxTIGdmFtd7Y18r2c inDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x/yvF6rLcefKp4F7fvRvQvJ/7u8JYj73jUiGjQmP4Es=; b=YKx8vnLH6B356B9HJzMPU2cgXYcYaDlCPiltQx2vFiVuVT3oWzSCyGtl3Ebop3fdUE kk+f7PHm5Xm0TWGXuQ19/RJm4Oi9qclCoi/NOtmBdKnh/VBljow2gtjLOPwld8mUXBsZ LSsluvPY63/XBVniLCW0nGi+2g+0j7iKbZ2i0NQUBezdY95pwnteJETtexT49luO3eIr zYPITCsFBjr9eG0QvSqKV/Ho9p8rMiejlXKVXCMkhhr+A0Mlu/3BuY4zoARKK4TCLUQr oDKCfACF+T7Lm1LiOWZTFewrXE2hGP3zNusDr8TpyfooSP/R+5WnUbRJaXCow22QvUec Ka1g== X-Gm-Message-State: APzg51B7wufA9fAbrQsLzoxQwvXL7loNAsQLtbhADMmSPiqmCQozoE0i x19kOz9YdLrHBKHkSbqxksL07xWT X-Google-Smtp-Source: ANB0VdbQT7TO6eZ8x2+rchvv5LvbDSEl3Ypx00Jpw6oGROe0MNoJDhbAj3mXFYqnZ4iMlMDoOMHdGw== X-Received: by 2002:a17:902:33c2:: with SMTP id b60-v6mr1323576plc.11.1536217282741; Thu, 06 Sep 2018 00:01:22 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.37]) by smtp.gmail.com with ESMTPSA id u195-v6sm7697017pgb.21.2018.09.06.00.01.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Sep 2018 00:01:22 -0700 (PDT) From: guangrong.xiao@gmail.com X-Google-Original-From: xiaoguangrong@tencent.com To: pbonzini@redhat.com, mst@redhat.com, mtosatti@redhat.com Date: Thu, 6 Sep 2018 15:01:01 +0800 Message-Id: <20180906070101.27280-4-xiaoguangrong@tencent.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180906070101.27280-1-xiaoguangrong@tencent.com> References: <20180906070101.27280-1-xiaoguangrong@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62a Subject: [Qemu-devel] [PATCH v6 3/3] migration: use save_page_use_compression in flush_compressed_data X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, quintela@redhat.com, Xiao Guangrong , qemu-devel@nongnu.org, peterx@redhat.com, dgilbert@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xiao Guangrong It avoids to touch compression locks if xbzrle and compression are both enabled Signed-off-by: Xiao Guangrong Reviewed-by: Juan Quintela --- migration/ram.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 65a563993d..747dd9208b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1932,11 +1932,13 @@ update_compress_thread_counts(const CompressParam *param, int bytes_xmit) compression_counters.pages++; } +static bool save_page_use_compression(RAMState *rs); + static void flush_compressed_data(RAMState *rs) { int idx, len, thread_count; - if (!migrate_use_compression()) { + if (!save_page_use_compression(rs)) { return; } thread_count = migrate_compress_threads();