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: 10589939 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 E31D3174C for ; Thu, 6 Sep 2018 07:01:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC04C2A4FE for ; Thu, 6 Sep 2018 07:01:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D025E2A509; Thu, 6 Sep 2018 07:01:24 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8673A2A4FE for ; Thu, 6 Sep 2018 07:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727739AbeIFLfV (ORCPT ); Thu, 6 Sep 2018 07:35:21 -0400 Received: from mail-pl1-f175.google.com ([209.85.214.175]:44204 "EHLO mail-pl1-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727732AbeIFLfV (ORCPT ); Thu, 6 Sep 2018 07:35:21 -0400 Received: by mail-pl1-f175.google.com with SMTP id ba4-v6so4510662plb.11 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=T4zx0ckRh56KCb7Ob3doxlGCtDrhYCAVBsAiYy0sgvAETo8+s0H4Z9/tc3Xj3SDL9V z0SNnLBzy14TTSBLpBIZMJYjigFVahoeiXAnOxi074lKKSMvSppIN1gkcGP33XYX5K8x gyvHdj6isRUyuph67gphxu35gFd3a0RdzISenqy02IgUlgXPzcwYAqatP42US0Ev2CDF PS4Mwd6p2qHnOFNyf00UJjrrwUKN3HQk0zmRUpHQKAFgTLVRz+pl+tos4AhC+g86fklN Y2mD7MRnUIT9Wk9+9udI0mADAUa/065REb3lctzcvZiyXT0jXvp+iqpgy5boe/4QOvHs T4fw== X-Gm-Message-State: APzg51B/yZdt1ADFMhbuyUDm+lP9DnXzH3PKBf3QeTPadXyRN5tBR31x fekIYziCf3ZkQcV3xK1iLSA= 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 Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, dgilbert@redhat.com, peterx@redhat.com, wei.w.wang@intel.com, jiang.biao2@zte.com.cn, eblake@redhat.com, quintela@redhat.com, Xiao Guangrong Subject: [PATCH v6 3/3] migration: use save_page_use_compression in flush_compressed_data 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> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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();