qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>,
	afaerber@suse.de, amit.shah@redhat.com, dgilbert@redhat.com,
	borntraeger@de.ibm.com, quintela@redhat.com,
	qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 1/5] cpu: Provide vcpu throttling interface
Date: Fri, 04 Sep 2015 11:17:54 -0400	[thread overview]
Message-ID: <55E9B622.7040708@linux.vnet.ibm.com> (raw)
In-Reply-To: <55E6173F.5000800@redhat.com>

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 <jjherne@linux.vnet.ibm.com>
>> Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
>> ---
>>   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 (jjherne@linux.vnet.ibm.com)

  reply	other threads:[~2015-09-04 15:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 14:45 [Qemu-devel] [PATCH v5 0/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-09-01 14:45 ` [Qemu-devel] [PATCH v5 1/5] cpu: Provide vcpu throttling interface Jason J. Herne
2015-09-01 21:23   ` Eric Blake
2015-09-04 15:17     ` Jason J. Herne [this message]
2015-09-01 14:46 ` [Qemu-devel] [PATCH v5 2/5] migration: Parameters for auto-converge cpu throttling Jason J. Herne
2015-09-01 21:26   ` Eric Blake
2015-09-04 15:09     ` Jason J. Herne
2015-09-01 14:46 ` [Qemu-devel] [PATCH v5 3/5] migration: Dynamic cpu throttling for auto-converge Jason J. Herne
2015-09-01 21:30   ` Eric Blake
2015-09-04 14:54     ` Jason J. Herne
2015-09-01 14:46 ` [Qemu-devel] [PATCH v5 4/5] qmp/hmp: Add throttle ratio to query-migrate and info migrate Jason J. Herne
2015-09-01 21:31   ` Eric Blake
2015-09-01 14:46 ` [Qemu-devel] [PATCH v5 5/5] migration: Disambiguate MAX_THROTTLE Jason J. Herne
2015-09-01 21:32   ` Eric Blake

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=55E9B622.7040708@linux.vnet.ibm.com \
    --to=jjherne@linux.vnet.ibm.com \
    --cc=afaerber@suse.de \
    --cc=amit.shah@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=pbonzini@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).