migration: Create migrate_max_cpu_throttle()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
Juan Quintela 2023-03-02 01:13:01 +01:00
parent f94a858fa3
commit 24155bd052
4 changed files with 11 additions and 3 deletions

View File

@ -451,8 +451,6 @@ bool migrate_postcopy(void);
int migrate_use_tls(void);
int migrate_max_cpu_throttle(void);
uint64_t ram_get_total_transferred_pages(void);
/* Sending on the return path - generic and then for each message type */

View File

@ -517,6 +517,15 @@ int migrate_decompress_threads(void)
return s->parameters.decompress_threads;
}
uint8_t migrate_max_cpu_throttle(void)
{
MigrationState *s;
s = migrate_get_current();
return s->parameters.max_cpu_throttle;
}
int64_t migrate_max_postcopy_bandwidth(void)
{
MigrationState *s;

View File

@ -51,6 +51,7 @@ int migrate_compress_level(void);
int migrate_compress_threads(void);
int migrate_compress_wait_thread(void);
int migrate_decompress_threads(void);
uint8_t migrate_max_cpu_throttle(void);
int64_t migrate_max_postcopy_bandwidth(void);
int migrate_multifd_channels(void);
MultiFDCompression migrate_multifd_compression(void);

View File

@ -715,7 +715,7 @@ static void mig_throttle_guest_down(uint64_t bytes_dirty_period,
uint64_t pct_initial = s->parameters.cpu_throttle_initial;
uint64_t pct_increment = s->parameters.cpu_throttle_increment;
bool pct_tailslow = s->parameters.cpu_throttle_tailslow;
int pct_max = s->parameters.max_cpu_throttle;
int pct_max = migrate_max_cpu_throttle();
uint64_t throttle_now = cpu_throttle_get_percentage();
uint64_t cpu_now, cpu_ideal, throttle_inc;