From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: kevin.tian@intel.com, Juan Quintela <quintela@redhat.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
Peter Xu <peterx@redhat.com>,
gloryxiao@tencent.com, Wei Wang <wei.w.wang@intel.com>,
yi.y.sun@intel.com
Subject: Re: [PATCH v3] migration/xbzrle: add encoding rate
Date: Thu, 4 Jun 2020 10:38:28 +0100 [thread overview]
Message-ID: <20200604093828.GB2851@work-vm> (raw)
In-Reply-To: <4b9cd244-0d96-d1c8-11ec-b61a6bc2bfaa@linaro.org>
* Richard Henderson (richard.henderson@linaro.org) wrote:
> On 6/3/20 7:58 PM, Wei Wang wrote:
> > It is possible that encoded_size==0, but unencoded_size !=0. For example,
> > a page is written with the same data that it already has.
>
> That really contains 0 bytes?
> Not even the ones that say "same data"?
>
> You certainly have a magical compression algorithm there.
> Or bad accounting.
We just don't bother sending the page at all in the case it's not
changed; no headers, no nothing:
if (encoded_len == 0) {
trace_save_xbzrle_page_skipping();
return 0;
and that's xbzrle having correctly done it's job.
> > The encoding_rate is expected to reflect if the page is xbzrle encoding friendly.
> > The larger, the more friendly, so 0 might not be a good representation here.
> >
> > Maybe, we could change UINT64_MAX above to "~0ULL" to avoid the issue?
>
> ~0ull is no different than UINT64_MAX -- indeed, they are *exactly* the same
> value -- and is not an exactly representible floating-point value.
>
> If unencoded_size != 0, and (somehow) encoded_size == 0, then
>
> unencoded_size / encoded_size = Inf
>
> which is indeed the limit of x -> 0, n / x.
>
> Which is *also* printable by %0.2f.
>
> I still contend that the middle if should be removed, and you should print out
> whatever's left. Either NaN or Inf is instructive. Certainly nothing in the
> middle cares about the actual value.
Hmm OK; I'll admit to not liking NaN/Inf in output.
Dave
>
> r~
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-06-04 9:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 0:59 [PATCH v3] migration/xbzrle: add encoding rate Wei Wang
2020-04-30 9:00 ` Dr. David Alan Gilbert
2020-05-07 15:53 ` Dr. David Alan Gilbert
2020-06-03 19:28 ` Richard Henderson
2020-06-04 2:58 ` Wei Wang
2020-06-04 3:22 ` Richard Henderson
2020-06-04 6:46 ` Wei Wang
2020-06-04 9:38 ` Dr. David Alan Gilbert [this message]
2020-06-04 10:27 ` Wei Wang
2020-06-04 16:57 ` Richard Henderson
2020-06-05 2:04 ` Wei Wang
2020-06-05 9:25 ` Dr. David Alan Gilbert
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=20200604093828.GB2851@work-vm \
--to=dgilbert@redhat.com \
--cc=gloryxiao@tencent.com \
--cc=kevin.tian@intel.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=richard.henderson@linaro.org \
--cc=wei.w.wang@intel.com \
--cc=yi.y.sun@intel.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).