qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hyman Huang <yong.huang@smartx.com>
To: qemu-devel@nongnu.org
Cc: "Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
	"Eric Blake" <eblake@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	yong.huang@smartx.com
Subject: [PATCH RESEND RFC 06/10] migration: Support periodic CPU throttle
Date: Mon,  9 Sep 2024 22:25:39 +0800	[thread overview]
Message-ID: <c1ac9e22b0f087b2ddb2d3766171459a149b394e.1725891841.git.yong.huang@smartx.com> (raw)
In-Reply-To: <cover.1725891841.git.yong.huang@smartx.com>

When VM is configured with huge memory, the current throttle logic
doesn't look like to scale, because migration_trigger_throttle()
is only called for each iteration, so it won't be invoked for a long
time if one iteration can take a long time.

The periodic sync and throttle aims to fix the above issue by
synchronizing the remote dirty bitmap and triggering the throttle
periodically. This is a trade-off between synchronization overhead
and CPU throttle impact.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
 migration/migration.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/migration/migration.c b/migration/migration.c
index 055d527ff6..fefd93b683 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1420,6 +1420,9 @@ static void migrate_fd_cleanup(MigrationState *s)
             qemu_thread_join(&s->thread);
             s->migration_thread_running = false;
         }
+        if (migrate_periodic_throttle()) {
+            periodic_throttle_stop();
+        }
         bql_lock();
 
         multifd_send_shutdown();
@@ -3263,6 +3266,9 @@ static MigIterateState migration_iteration_run(MigrationState *s)
 
     if ((!pending_size || pending_size < s->threshold_size) && can_switchover) {
         trace_migration_thread_low_pending(pending_size);
+        if (migrate_periodic_throttle()) {
+            periodic_throttle_stop();
+        }
         migration_completion(s);
         return MIG_ITERATE_BREAK;
     }
@@ -3508,6 +3514,11 @@ static void *migration_thread(void *opaque)
     ret = qemu_savevm_state_setup(s->to_dst_file, &local_err);
     bql_unlock();
 
+    if (migrate_periodic_throttle()) {
+        periodic_throttle_setup(true);
+        periodic_throttle_start();
+    }
+
     qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP,
                                MIGRATION_STATUS_ACTIVE);
 
-- 
2.39.1



  parent reply	other threads:[~2024-09-09 14:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 14:25 [PATCH RESEND RFC 00/10] migration: auto-converge refinements for huge VM Hyman Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 01/10] migration: Introduce structs for periodic CPU throttle Hyman Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 02/10] migration: Refine util functions to support " Hyman Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 03/10] qapi/migration: Introduce periodic CPU throttling parameters Hyman Huang
2024-09-09 21:30   ` Peter Xu
2024-09-10  5:47     ` Yong Huang
2024-09-10 13:56       ` Peter Xu
2024-09-09 14:25 ` [PATCH RESEND RFC 04/10] qapi/migration: Introduce the iteration-count Hyman Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 05/10] migration: Introduce util functions for periodic CPU throttle Hyman Huang
2024-09-09 14:25 ` Hyman Huang [this message]
2024-09-09 14:25 ` [PATCH RESEND RFC 07/10] tests/migration-tests: Add test case for periodic throttle Hyman Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 08/10] migration: Introduce cpu-responsive-throttle parameter Hyman Huang
2024-09-10  6:00   ` Yong Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 09/10] migration: Support responsive CPU throttle Hyman Huang
2024-09-09 14:25 ` [PATCH RESEND RFC 10/10] tests/migration-tests: Add test case for " Hyman Huang

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=c1ac9e22b0f087b2ddb2d3766171459a149b394e.1725891841.git.yong.huang@smartx.com \
    --to=yong.huang@smartx.com \
    --cc=armbru@redhat.com \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=farosas@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.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).