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: Jason J. Herne
Subject: Re: [Qemu-devel] [PATCH v5 1/5] cpu: Provide vcpu throttling interface
Date: Fri, 04 Sep 2015 11:17:54 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 09/01/2015 05:23 PM, Eric Blake wrote:
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).


You are 100% correct here. This comment is a relic of an older version. Nice find :)
I'll update the docs and incorporate your suggestions.

--
-- Jason J. Herne (address@hidden)




reply via email to

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