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 3/5] migration: Dynamic cpu throttling for auto-converge
Date: Fri, 04 Sep 2015 10:54:59 -0400 [thread overview]
Message-ID: <55E9B0C3.4080807@linux.vnet.ibm.com> (raw)
In-Reply-To: <55E6190B.8050501@redhat.com>
On 09/01/2015 05:30 PM, Eric Blake wrote:
> On 09/01/2015 08:46 AM, Jason J. Herne wrote:
>> Remove traditional auto-converge static 30ms throttling code and replace it
>> with a dynamic throttling algorithm.
>>
>> Additionally, be more aggressive when deciding when to start throttling.
>> Previously we waited until four unproductive memory passes. Now we begin
>> throttling after only two unproductive memory passes. Four seemed quite
>> arbitrary and only waiting for two passes allows us to complete the migration
>> faster.
>>
>> Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
>> Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
>> ---
>> arch_init.c | 88 ++++++++++++++++++---------------------------------
>> migration/migration.c | 4 +++
>> 2 files changed, 34 insertions(+), 58 deletions(-)
>
>> +static void mig_throttle_guest_down(void)
>> +{
>> + MigrationState *s = migrate_get_current();
>> + uint64_t pct_initial =
>> + s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INITIAL];
>> + uint64_t pct_icrement =
>> + s->parameters[MIGRATION_PARAMETER_X_CPU_THROTTLE_INCREMENT];
>> +
>> + /* We have not started throttling yet. Let's start it. */
>> + if (!cpu_throttle_active()) {
>> + cpu_throttle_set(pct_initial);
>> + } else {
>> + /* Throttling already on, just increase the rate */
>> + cpu_throttle_set(cpu_throttle_get_percentage() + pct_icrement);
>
> What happens if the addition results in a percentage larger than 99?
>
cpu_throttle_set takes responsibility for upper/lower bounds capping.
+void cpu_throttle_set(int new_throttle_pct)
+{
+ /* Ensure throttle percentage is within valid range */
+ new_throttle_pct = MIN(new_throttle_pct, CPU_THROTTLE_PCT_MAX);
+ new_throttle_pct = MAX(new_throttle_pct, CPU_THROTTLE_PCT_MIN);
+
+ atomic_set(&throttle_percentage, new_throttle_pct);
+
+ timer_mod(throttle_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL_RT) +
+ CPU_THROTTLE_TIMESLICE);
+}
+
--
-- Jason J. Herne (jjherne@linux.vnet.ibm.com)
next prev parent reply other threads:[~2015-09-04 14:56 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
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 [this message]
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=55E9B0C3.4080807@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).