mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-30 22:03:54 -06:00
migration: We set the rate_limit by a second
That the implementation does the check every 100 milliseconds is an implementation detail that shouldn't be seen on the interfaz. Notice that all callers of qemu_file_set_rate_limit() used the division or pass 0, so this change is a NOP. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20230508130909.65420-4-quintela@redhat.com>
This commit is contained in:
parent
52d01d4a5d
commit
9d3ebbe217
3 changed files with 10 additions and 7 deletions
|
@ -2140,7 +2140,7 @@ static int postcopy_start(MigrationState *ms)
|
||||||
* will notice we're in POSTCOPY_ACTIVE and not actually
|
* will notice we're in POSTCOPY_ACTIVE and not actually
|
||||||
* wrap their state up here
|
* wrap their state up here
|
||||||
*/
|
*/
|
||||||
qemu_file_set_rate_limit(ms->to_dst_file, bandwidth / XFER_LIMIT_RATIO);
|
qemu_file_set_rate_limit(ms->to_dst_file, bandwidth);
|
||||||
if (migrate_postcopy_ram()) {
|
if (migrate_postcopy_ram()) {
|
||||||
/* Ping just for debugging, helps line traces up */
|
/* Ping just for debugging, helps line traces up */
|
||||||
qemu_savevm_send_ping(ms->to_dst_file, 2);
|
qemu_savevm_send_ping(ms->to_dst_file, 2);
|
||||||
|
@ -3231,11 +3231,10 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
|
||||||
|
|
||||||
if (resume) {
|
if (resume) {
|
||||||
/* This is a resumed migration */
|
/* This is a resumed migration */
|
||||||
rate_limit = migrate_max_postcopy_bandwidth() /
|
rate_limit = migrate_max_postcopy_bandwidth();
|
||||||
XFER_LIMIT_RATIO;
|
|
||||||
} else {
|
} else {
|
||||||
/* This is a fresh new migration */
|
/* This is a fresh new migration */
|
||||||
rate_limit = migrate_max_bandwidth() / XFER_LIMIT_RATIO;
|
rate_limit = migrate_max_bandwidth();
|
||||||
|
|
||||||
/* Notify before starting migration thread */
|
/* Notify before starting migration thread */
|
||||||
notifier_list_notify(&migration_state_notifiers, s);
|
notifier_list_notify(&migration_state_notifiers, s);
|
||||||
|
|
|
@ -1243,7 +1243,7 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
||||||
s->parameters.max_bandwidth = params->max_bandwidth;
|
s->parameters.max_bandwidth = params->max_bandwidth;
|
||||||
if (s->to_dst_file && !migration_in_postcopy()) {
|
if (s->to_dst_file && !migration_in_postcopy()) {
|
||||||
qemu_file_set_rate_limit(s->to_dst_file,
|
qemu_file_set_rate_limit(s->to_dst_file,
|
||||||
s->parameters.max_bandwidth / XFER_LIMIT_RATIO);
|
s->parameters.max_bandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1273,7 +1273,7 @@ static void migrate_params_apply(MigrateSetParameters *params, Error **errp)
|
||||||
s->parameters.max_postcopy_bandwidth = params->max_postcopy_bandwidth;
|
s->parameters.max_postcopy_bandwidth = params->max_postcopy_bandwidth;
|
||||||
if (s->to_dst_file && migration_in_postcopy()) {
|
if (s->to_dst_file && migration_in_postcopy()) {
|
||||||
qemu_file_set_rate_limit(s->to_dst_file,
|
qemu_file_set_rate_limit(s->to_dst_file,
|
||||||
s->parameters.max_postcopy_bandwidth / XFER_LIMIT_RATIO);
|
s->parameters.max_postcopy_bandwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (params->has_max_cpu_throttle) {
|
if (params->has_max_cpu_throttle) {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "migration.h"
|
#include "migration.h"
|
||||||
#include "qemu-file.h"
|
#include "qemu-file.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "options.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
|
|
||||||
#define IO_BUF_SIZE 32768
|
#define IO_BUF_SIZE 32768
|
||||||
|
@ -744,7 +745,10 @@ int64_t qemu_file_get_rate_limit(QEMUFile *f)
|
||||||
|
|
||||||
void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit)
|
void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit)
|
||||||
{
|
{
|
||||||
f->rate_limit_max = limit;
|
/*
|
||||||
|
* 'limit' is per second. But we check it each 100 miliseconds.
|
||||||
|
*/
|
||||||
|
f->rate_limit_max = limit / XFER_LIMIT_RATIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qemu_file_reset_rate_limit(QEMUFile *f)
|
void qemu_file_reset_rate_limit(QEMUFile *f)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue