fix dirtyring not converge use small dirtylimit
PATCH 1/1 fix dirtyring not converge use small dirtylimit
From: fuqiang wang <[email protected]>
When using a low dirtylimit to restrict a VM with a high dirty ratio, such as in the guestperf test scenario compr-dirty-limit-period-1000 (dirtylimit=1), this can lead to too long sleep times for the vcpu threads and the migration thread may have to wait vcpu thread due to the kick operation, and during this waiting period, the guest will make some dirty pages at a high speed, which causes convergence issues.
However, during the vcpu thread sleeping, it is not in kernel space (kvm), so there is no need to wait for a kick.
Signed-off-by wangfuqiang49 <[email protected]>
--- accel/kvm/kvm-all.c | 6 +++++- include/hw/core/cpu.h | 1 + system/cpus.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-)
accel/kvm/kvm-all.c +5 -1
@@ -926,7 +926,9 @@ static void kvm_cpu_synchronize_kick_all(void)CPUState *cpu;CPU_FOREACH (cpu) { -run_on_cpu (cpu, do_kvm_cpu_synchronize_kick,RUN_ON_CPU_NULL ); +if (cpu->vcpu_in_kvm) { +run_on_cpu (cpu, do_kvm_cpu_synchronize_kick,RUN_ON_CPU_NULL ); + } } }
@@ -3131,7 +3133,9 @@ int kvm_cpu_exec(CPUState *cpu)*/ smp_rmb (); + cpu->vcpu_in_kvm = true; run_ret =kvm_vcpu_ioctl (cpu,KVM_RUN ,0 ); + cpu->vcpu_in_kvm = false; attrs =kvm_arch_post_run (cpu, run);
include/hw/core/cpu.h +1 -0
@@ -537,6 +537,7 @@ struct CPUState {uint64_t dirty_pages;int kvm_vcpu_stats_fd;bool vcpu_dirty; +bool vcpu_in_kvm;/* Use by accel-block: CPU is executing an ioctl() */ QemuLockCnt in_ioctl_lock;
system/cpus.c +1 -0
@@ -670,6 +670,7 @@ void qemu_init_vcpu(CPUState *cpu) cpu->nr_threads = ms->smp.threads; cpu->stopped = true; cpu->random_seed =qemu_guest_random_seed_thread_part1 (); + cpu->vcpu_in_kvm = false;if (!cpu->as) {/* If the target cpu hasn't set up any address spaces itself,
Signature · 1 line
2.47.0