From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: quintela@redhat.com, dgilbert@redhat.com
Subject: [PATCH] migration: Fix the minus value for compressed_size
Date: Mon, 10 Oct 2022 17:34:15 +0800 [thread overview]
Message-ID: <20221010093415.2779165-1-zhenzhong.duan@intel.com> (raw)
When update_compress_thread_counts() is called first time, there is
no data stream yet. We see compression_counters.compressed_size
becomes minus value shortly.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
migration/ram.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/migration/ram.c b/migration/ram.c
index dc1de9ddbc68..510db95cdc36 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -1443,6 +1443,10 @@ static bool do_compress_ram_page(QEMUFile *f, z_stream *stream, RAMBlock *block,
static void
update_compress_thread_counts(const CompressParam *param, int bytes_xmit)
{
+ if (bytes_xmit <= 0) {
+ return;
+ }
+
ram_transferred_add(bytes_xmit);
if (param->zero_page) {
--
2.25.1
next reply other threads:[~2022-10-10 9:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 9:34 Zhenzhong Duan [this message]
2022-10-10 10:34 ` [PATCH] migration: Fix the minus value for compressed_size Dr. David Alan Gilbert
2022-10-10 10:58 ` Duan, Zhenzhong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221010093415.2779165-1-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).