On Fri, Dec 03, 2021 at 09:39:47AM +0800, huang...@chinatelecom.cn wrote: > +void dirtylimit_setup(int max_cpus) > +{ > + if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { > + return; > + } > + > + dirtylimit_calc_state_init(max_cpus); > + dirtylimit_state_init(max_cpus); > +}
[...] > diff --git a/softmmu/vl.c b/softmmu/vl.c > index 620a1f1..0f83ce3 100644 > --- a/softmmu/vl.c > +++ b/softmmu/vl.c > @@ -3777,5 +3777,6 @@ void qemu_init(int argc, char **argv, char **envp) > qemu_init_displays(); > accel_setup_post(current_machine); > os_setup_post(); > + dirtylimit_setup(current_machine->smp.max_cpus); > resume_mux_open(); Can we do the init only when someone enables it? We could also do proper free() for the structs when it's globally turned off. -- Peter Xu