From patchwork Thu Sep 6 07:00:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10589943 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 132C413BB for ; Thu, 6 Sep 2018 07:02:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DACA2A5AA for ; Thu, 6 Sep 2018 07:02:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01E412A5F9; Thu, 6 Sep 2018 07:02:47 +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 ABE702A5AA for ; Thu, 6 Sep 2018 07:02:47 +0000 (UTC) Received: from localhost ([::1]:59858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxoJS-0001TF-Ub for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Sep 2018 03:02:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxoI6-0001PM-0D for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxoI4-0008B6-Cq for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:21 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:44726) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fxoHz-000887-Va for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:19 -0400 Received: by mail-pl1-x634.google.com with SMTP id ba4-v6so4510473plb.11 for ; Thu, 06 Sep 2018 00:01:15 -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=rfQjjZoYN8ey6JzyEFUHP7aTftpMshBfTWmwy04gytM=; b=ZXHBPDR5o+zImRH2BS5ZWyh1BhK4II1mfOrl+ZCfAYlDHOtz942pD+eCUoaJmf2C/D HTHj0TSShk3r/RZp1+O8SZXL2I5YZMoRzh5yO0UDjuuChgi4bvTTWaBtTjPyP3QZMXZA mz0f0mitNdazo/8S2qFF6CY8AnzyzbYeYUxGCDyPSsDCOmMvf8/fMNGfrd/3BRG+7Oxj i8nvYWamTXbeOypZkfBZX5E3FiqJLpUCzdDXpVZ4+b7ueshy/ne+KT6PwnBpcXSih+I/ g9MDEbMW+Wq46ioeDRUKIBFUdp6pcipbs1Ll2UslXU6epXeebT/9J8B9B595rQiX4ZQn TbiQ== 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=rfQjjZoYN8ey6JzyEFUHP7aTftpMshBfTWmwy04gytM=; b=QSH7lkdKIBWqyoProZ3YX5QZDrKh6zPucg6Z4zN/MN6AKIdWcd0Suftzj1y/xWg+Zc nBxA/bpvs28ddh0DNSHQG5gjMgZIFvlrCVaz8xJgs9ch5F2GmtI2EuaP/VmCN2RlQc9l yDI9ZUmMcZi74Q3rqdrTVloG5NRdlcoq23A4oBmnUA0b7qOQY3GJ4VmylpNqLw20Nf29 SoGZd5oWuxm2OTp59SSjadCFTLtXtJTCxCu0ubgNL/oXdYUvUS/p1AWCu0LJc3wYf/hM yGvIVgtUD4BlzqNPqkVZR8ZErYl/Z6JqkOOmIlBRK19LHNP+FIpSH6HbfQ9f0DNEfU2w AB5w== X-Gm-Message-State: APzg51DS0WdJCJWyeBIXx6Wr+rdXz9cZRQ5ZHKJFbGorRik6ENxnpR5U UozIfxZCF+OP3PAJsSWa78s= X-Google-Smtp-Source: ANB0VdZKV2VHxnwkbzx3ENQfi43vyK6E3D0lT9iX06m7MhX3zauxiP/7EbvexJC+xul5HlMWpubMHA== X-Received: by 2002:a17:902:be07:: with SMTP id r7-v6mr1282618pls.275.1536217274359; Thu, 06 Sep 2018 00:01:14 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Sep 2018 00:01:13 -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:00:59 +0800 Message-Id: <20180906070101.27280-2-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::634 Subject: [Qemu-devel] [PATCH v6 1/3] migration: do not flush_compressed_data at the end of iteration 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 flush_compressed_data() needs to wait all compression threads to finish their work, after that all threads are free until the migration feeds new request to them, reducing its call can improve the throughput and use CPU resource more effectively We do not need to flush all threads at the end of iteration, the data can be kept locally until the memory block is changed or memory migration starts over in that case we will meet a dirtied page which may still exists in compression threads's ring Signed-off-by: Xiao Guangrong Reviewed-by: Juan Quintela --- migration/ram.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 2add09174d..e152831254 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1996,17 +1996,22 @@ static bool find_dirty_block(RAMState *rs, PageSearchStatus *pss, bool *again) pss->page = 0; pss->block = QLIST_NEXT_RCU(pss->block, next); if (!pss->block) { + /* + * If memory migration starts over, we will meet a dirtied page + * which may still exists in compression threads's ring, so we + * should flush the compressed data to make sure the new page + * is not overwritten by the old one in the destination. + * + * Also If xbzrle is on, stop using the data compression at this + * point. In theory, xbzrle can do better than compression. + */ + flush_compressed_data(rs); + /* Hit the end of the list */ pss->block = QLIST_FIRST_RCU(&ram_list.blocks); /* Flag that we've looped */ pss->complete_round = true; rs->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(rs); - } } /* Didn't find anything this time, but try again on the new block */ *again = true; @@ -3219,7 +3224,6 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) } i++; } - flush_compressed_data(rs); rcu_read_unlock(); /* From patchwork Thu Sep 6 07:01:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Guangrong X-Patchwork-Id: 10589945 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 78DB813BB for ; Thu, 6 Sep 2018 07:02:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 711092A5AA for ; Thu, 6 Sep 2018 07:02:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63DC32A5F9; Thu, 6 Sep 2018 07:02:51 +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 CAB8C2A5AA for ; Thu, 6 Sep 2018 07:02:50 +0000 (UTC) Received: from localhost ([::1]:59864 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxoJW-0003a1-0N for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Sep 2018 03:02:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxoIA-0001S4-Ly for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxoI4-0008Bd-KX for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:26 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:45462) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fxoI4-0008A4-Bu for qemu-devel@nongnu.org; Thu, 06 Sep 2018 03:01:20 -0400 Received: by mail-pf1-x444.google.com with SMTP id i26-v6so4775779pfo.12 for ; Thu, 06 Sep 2018 00:01:19 -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=pt4nvbP+U1jEtDfLwvgl4Hy4NKYiBNWVYv3Xrchqpfk=; b=ZvuyTV3T+5kcdAR4Mla16fkju9GltdYIrTNDGq1O2uL/Um9cInGvcYOr2ejWRPknxG z4UD0zmYDr3Qo2irC9fubuDOJRT3pY29+sZyuP5hRdaXVpPphoS2/knY5OC9DO7Q8Rb8 YbWvcjKEOr6vojAcOCNtQV43oVPsuht/tpSjZUwfgWBEJRo19yrTabRscw8zCbpSiU5V 0G9XTv0UojWmNr29lMnDUDjPVS8vEKdDSOoItZkLPw7Ep8A4sZIYALC+QwMfUaK5X1CA Ejn7WBGBzBN+xbK11Wry14ZqeuXfI1kBguONZpTJ8NVKaY7+/CR0Eh0B7LQsr4DDe99N YgOQ== 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=pt4nvbP+U1jEtDfLwvgl4Hy4NKYiBNWVYv3Xrchqpfk=; b=pO9gYxtPjnQz6/+lzDAV4qICIjWzIqdS6pdw1XBnTAelcCVb0hWkBudfZZuV2ar9xt +Fd1yQRNM3Z8mHsxTTcTpkIQQcvPpYvN+4/e3zsFX360KUNpH9YFlHhpdWGEMym5wRrf uhwcZifGk0UCfMAsSII2H/kv7RIR3wERia6m1w4K7HP01joU1FM1t/2e73/LyJheAAoe b3j8zBlmGf5np28grJ/O8A/RF93sfwOpHYez9/pqMTuhzAa+gu68iE8nQQZwe1V3gVov A+YOrAEBupIVzOvQ0OcQyXMFDFrBUOGPNpxMvWNJ7efZsi3AhyVyp2eRQdqUv2IU6bMB TjEw== X-Gm-Message-State: APzg51BpGgLBj1O4FvvLBmc6j0910vtJVPK+Ng5EJAdeQ+JDhpgfzY6S w6rt+HtKBPVaSryqDKZZszo= X-Google-Smtp-Source: ANB0VdbMmRMAGOosW9lp8F2f59IP30YzhVNEDRqpokbVU0NVx+KWEwaZpx4OhXziA+PD3UGEfplLkw== X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr1344290pge.325.1536217278582; Thu, 06 Sep 2018 00:01:18 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Sep 2018 00:01:18 -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:00 +0800 Message-Id: <20180906070101.27280-3-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::444 Subject: [Qemu-devel] [PATCH v6 2/3] migration: show the statistics of compression 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 Currently, it includes: pages: amount of pages compressed and transferred to the target VM busy: amount of count that no free thread to compress data busy-rate: rate of thread busy compressed-size: amount of bytes after compression compression-rate: rate of compressed size Reviewed-by: Juan Quintela Reviewed-by: Peter Xu Signed-off-by: Xiao Guangrong --- hmp.c | 13 +++++++++++++ migration/migration.c | 12 ++++++++++++ migration/ram.c | 41 ++++++++++++++++++++++++++++++++++++++++- migration/ram.h | 1 + qapi/migration.json | 26 +++++++++++++++++++++++++- 5 files changed, 91 insertions(+), 2 deletions(-) diff --git a/hmp.c b/hmp.c index 4975fa56b0..f57b23d889 100644 --- a/hmp.c +++ b/hmp.c @@ -271,6 +271,19 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) info->xbzrle_cache->overflow); } + if (info->has_compression) { + monitor_printf(mon, "compression pages: %" PRIu64 " pages\n", + info->compression->pages); + monitor_printf(mon, "compression busy: %" PRIu64 "\n", + info->compression->busy); + monitor_printf(mon, "compression busy rate: %0.2f\n", + info->compression->busy_rate); + monitor_printf(mon, "compressed size: %" PRIu64 "\n", + info->compression->compressed_size); + monitor_printf(mon, "compression rate: %0.2f\n", + info->compression->compression_rate); + } + if (info->has_cpu_throttle_percentage) { monitor_printf(mon, "cpu throttle percentage: %" PRIu64 "\n", info->cpu_throttle_percentage); diff --git a/migration/migration.c b/migration/migration.c index 4b316ec343..f1d662f928 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -758,6 +758,18 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->xbzrle_cache->overflow = xbzrle_counters.overflow; } + if (migrate_use_compression()) { + info->has_compression = true; + info->compression = g_malloc0(sizeof(*info->compression)); + info->compression->pages = compression_counters.pages; + info->compression->busy = compression_counters.busy; + info->compression->busy_rate = compression_counters.busy_rate; + info->compression->compressed_size = + compression_counters.compressed_size; + info->compression->compression_rate = + compression_counters.compression_rate; + } + if (cpu_throttle_active()) { info->has_cpu_throttle_percentage = true; info->cpu_throttle_percentage = cpu_throttle_get_percentage(); diff --git a/migration/ram.c b/migration/ram.c index e152831254..65a563993d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -301,6 +301,15 @@ struct RAMState { uint64_t num_dirty_pages_period; /* xbzrle misses since the beginning of the period */ uint64_t xbzrle_cache_miss_prev; + + /* compression statistics since the beginning of the period */ + /* amount of count that no free thread to compress data */ + uint64_t compress_thread_busy_prev; + /* amount bytes after compression */ + uint64_t compressed_size_prev; + /* amount of compressed pages */ + uint64_t compress_pages_prev; + /* total handled target pages at the beginning of period */ uint64_t target_page_count_prev; /* total handled target pages since start */ @@ -338,6 +347,8 @@ struct PageSearchStatus { }; typedef struct PageSearchStatus PageSearchStatus; +CompressionStats compression_counters; + struct CompressParam { bool done; bool quit; @@ -1593,6 +1604,7 @@ uint64_t ram_pagesize_summary(void) static void migration_update_rates(RAMState *rs, int64_t end_time) { uint64_t page_count = rs->target_page_count - rs->target_page_count_prev; + double compressed_size; /* calculate period counters */ ram_counters.dirty_pages_rate = rs->num_dirty_pages_period * 1000 @@ -1607,6 +1619,26 @@ static void migration_update_rates(RAMState *rs, int64_t end_time) rs->xbzrle_cache_miss_prev) / page_count; rs->xbzrle_cache_miss_prev = xbzrle_counters.cache_miss; } + + if (migrate_use_compression()) { + compression_counters.busy_rate = (double)(compression_counters.busy - + rs->compress_thread_busy_prev) / page_count; + rs->compress_thread_busy_prev = compression_counters.busy; + + compressed_size = compression_counters.compressed_size - + rs->compressed_size_prev; + if (compressed_size) { + double uncompressed_size = (compression_counters.pages - + rs->compress_pages_prev) * TARGET_PAGE_SIZE; + + /* Compression-Ratio = Uncompressed-size / Compressed-size */ + compression_counters.compression_rate = + uncompressed_size / compressed_size; + + rs->compress_pages_prev = compression_counters.pages; + rs->compressed_size_prev = compression_counters.compressed_size; + } + } } static void migration_bitmap_sync(RAMState *rs) @@ -1888,10 +1920,16 @@ exit: static void update_compress_thread_counts(const CompressParam *param, int bytes_xmit) { + ram_counters.transferred += bytes_xmit; + if (param->zero_page) { ram_counters.duplicate++; + return; } - ram_counters.transferred += bytes_xmit; + + /* 8 means a header with RAM_SAVE_FLAG_CONTINUE. */ + compression_counters.compressed_size += bytes_xmit - 8; + compression_counters.pages++; } static void flush_compressed_data(RAMState *rs) @@ -2264,6 +2302,7 @@ static bool save_compress_page(RAMState *rs, RAMBlock *block, ram_addr_t offset) return true; } + compression_counters.busy++; return false; } diff --git a/migration/ram.h b/migration/ram.h index 457bf54b8c..a139066846 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -36,6 +36,7 @@ extern MigrationStats ram_counters; extern XBZRLECacheStats xbzrle_counters; +extern CompressionStats compression_counters; int xbzrle_cache_resize(int64_t new_size, Error **errp); uint64_t ram_bytes_remaining(void); diff --git a/qapi/migration.json b/qapi/migration.json index f62d3f9a4b..6e8c21258a 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -75,6 +75,27 @@ 'cache-miss': 'int', 'cache-miss-rate': 'number', 'overflow': 'int' } } +## +# @CompressionStats: +# +# Detailed migration compression statistics +# +# @pages: amount of pages compressed and transferred to the target VM +# +# @busy: count of times that no free thread was available to compress data +# +# @busy-rate: rate of thread busy +# +# @compressed-size: amount of bytes after compression +# +# @compression-rate: rate of compressed size +# +# Since: 3.1 +## +{ 'struct': 'CompressionStats', + 'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number', + 'compressed-size': 'int', 'compression-rate': 'number' } } + ## # @MigrationStatus: # @@ -172,6 +193,8 @@ # only present when the postcopy-blocktime migration capability # is enabled. (Since 3.0) # +# @compression: migration compression statistics, only returned if compression +# feature is on and status is 'active' or 'completed' (Since 3.1) # # Since: 0.14.0 ## @@ -186,7 +209,8 @@ '*cpu-throttle-percentage': 'int', '*error-desc': 'str', '*postcopy-blocktime' : 'uint32', - '*postcopy-vcpu-blocktime': ['uint32']} } + '*postcopy-vcpu-blocktime': ['uint32'], + '*compression': 'CompressionStats'} } ## # @query-migrate: 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();