qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 1/5] cpu: Provide vcpu throttling interface


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v5 1/5] cpu: Provide vcpu throttling interface
Date: Tue, 1 Sep 2015 15:23:11 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 09/01/2015 08:45 AM, Jason J. Herne wrote:
> Provide a method to throttle guest cpu execution. CPUState is augmented with
> timeout controls and throttle start/stop functions. To throttle the guest cpu
> the caller simply has to call the throttle set function and provide a 
> percentage
> of throttle time.
> 
> Signed-off-by: Jason J. Herne <address@hidden>
> Reviewed-by: Matthew Rosato <address@hidden>
> ---
>  cpus.c            | 78 
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/qom/cpu.h | 43 ++++++++++++++++++++++++++++++
>  2 files changed, 121 insertions(+)
> 

> +/**
> + * cpu_throttle_set:
> + * @new_throttle_pct: Percent of sleep time to running time.

I don't think you mean the ratio of sleep time to running time, as much
as sleep time to overall time.

That is, 10% should mean "sleep 1ms and run 9ms out of every 10ms
total", and not "sleep 1ms after every 10ms run, for 90.9% duty cycle".

> + *                    Valid range is 1 to 99.
> + *
> + * Throttles all vcpus by forcing them to sleep for the given percentage of
> + * time. A throttle_percentage of 50 corresponds to a 50% duty cycle roughly.
> + * (example: 10ms sleep for every 10ms awake).

50% can be a bit ambiguous (not obvious whether a higher percentage
means more sleep or more time awake); it might be better to pick a
different number, such as:

A throttle_percentage of 25 corresponds to a 75% duty cycle (example:
10ms sleep for every 30ms awake).

if the percentage really is [1 - duty cycle] (which I suspect), or:

A throttle_percentage of 25 corresponds to a 80% duty cycle (example:
10ms sleep for every 40ms awake).

(if I'm wrong, and you really meant percentage of sleep time to running
time).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]