diff options
author | Hyman Huang(黄勇) <yong.huang@smartx.com> | 2023-06-07 23:30:50 +0800 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-07-26 10:55:56 +0200 |
commit | dc62395557b29312a9c2f9a1e0beece2557c3078 (patch) | |
tree | 46c5d5bb78b2371af4825676d451b74af3abeb6e /softmmu/dirtylimit.c | |
parent | 09f9ec99133ab5735b57486323d9c592630c9fc1 (diff) | |
download | qemu-dc62395557b29312a9c2f9a1e0beece2557c3078.zip qemu-dc62395557b29312a9c2f9a1e0beece2557c3078.tar.gz qemu-dc62395557b29312a9c2f9a1e0beece2557c3078.tar.bz2 |
migration: Introduce dirty-limit capability
Introduce migration dirty-limit capability, which can
be turned on before live migration and limit dirty
page rate durty live migration.
Introduce migrate_dirty_limit function to help check
if dirty-limit capability enabled during live migration.
Meanwhile, refactor vcpu_dirty_rate_stat_collect
so that period can be configured instead of hardcoded.
dirty-limit capability is kind of like auto-converge
but using dirty limit instead of traditional cpu-throttle
to throttle guest down. To enable this feature, turn on
the dirty-limit capability before live migration using
migrate-set-capabilities, and set the parameters
"x-vcpu-dirty-limit-period", "vcpu-dirty-limit" suitably
to speed up convergence.
Signed-off-by: Hyman Huang(黄勇) <yong.huang@smartx.com>
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <168618975839.6361.17407633874747688653-4@git.sr.ht>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'softmmu/dirtylimit.c')
-rw-r--r-- | softmmu/dirtylimit.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index e802010..942d876 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -24,6 +24,9 @@ #include "hw/boards.h" #include "sysemu/kvm.h" #include "trace.h" +#include "migration/misc.h" +#include "migration/migration.h" +#include "migration/options.h" /* * Dirtylimit stop working if dirty page rate error @@ -75,14 +78,21 @@ static bool dirtylimit_quit; static void vcpu_dirty_rate_stat_collect(void) { + MigrationState *s = migrate_get_current(); VcpuStat stat; int i = 0; + int64_t period = DIRTYLIMIT_CALC_TIME_MS; + + if (migrate_dirty_limit() && + migration_is_active(s)) { + period = s->parameters.x_vcpu_dirty_limit_period; + } /* calculate vcpu dirtyrate */ - vcpu_calculate_dirtyrate(DIRTYLIMIT_CALC_TIME_MS, - &stat, - GLOBAL_DIRTY_LIMIT, - false); + vcpu_calculate_dirtyrate(period, + &stat, + GLOBAL_DIRTY_LIMIT, + false); for (i = 0; i < stat.nvcpu; i++) { vcpu_dirty_rate_stat->stat.rates[i].id = i; |