From: Eric Blake <eblake@redhat.com>
To: Alberto Garcia <berto@igalia.com>, qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH for-2.10] throttle: Make LeakyBucket.avg and LeakyBucket.max integer types
Date: Mon, 7 Aug 2017 16:36:57 -0500 [thread overview]
Message-ID: <3bebf07f-0505-8236-b3f7-c8ee74a2ee2d@redhat.com> (raw)
In-Reply-To: <20170807161529.3779-1-berto@igalia.com>
[-- Attachment #1: Type: text/plain, Size: 1684 bytes --]
On 08/07/2017 11:15 AM, Alberto Garcia wrote:
> Both the throttling limits set with the throttling.iops-* and
> throttling.bps-* options and their QMP equivalents defined in the
> BlockIOThrottle struct are integer values.
>
> Those limits are also reported in the BlockDeviceInfo struct and they
> are integers there as well.
>
> Therefore there's no reason to store them internally as double and do
> the conversion everytime we're setting or querying them, so this patch
> uses int64_t for those types.
>
> LeakyBucket.level and LeakyBucket.burst_level do however remain double
> because their value changes depending on the fraction of time elapsed
> since the previous I/O operation.
>
> There's one particular instance of the previous code where bkt->max
> could have a non-integer value: that's in throttle_fix_bucket() when
> bkt->max is initialized to bkt->avg / 10. This is now an integer
> division and the result is rounded. We don't need to worry about this
> because:
>
> a) with the magnitudes we're dealing with (bytes per second, I/O
> operations per second) the limits are likely to be always
> multiples of 10.
>
> b) even if they weren't this doesn't affect the actual limits, only
> the algorithm that makes the throttling smoother.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> include/qemu/throttle.h | 4 ++--
> util/throttle.c | 7 ++-----
> 2 files changed, 4 insertions(+), 7 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2017-08-07 21:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 16:15 [Qemu-devel] [PATCH for-2.10] throttle: Make LeakyBucket.avg and LeakyBucket.max integer types Alberto Garcia
2017-08-07 21:36 ` Eric Blake [this message]
2017-08-08 10:00 ` Stefan Hajnoczi
2017-08-08 10:17 ` Alberto Garcia
2017-08-08 10:35 ` Alberto Garcia
2017-08-08 15:11 ` Eric Blake
2017-08-08 15:21 ` Alberto Garcia
2017-08-09 9:46 ` Stefan Hajnoczi
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=3bebf07f-0505-8236-b3f7-c8ee74a2ee2d@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).