Skip to content
Snippets Groups Projects
  • Jaroslav Jindrak's avatar
    f8d426a6
    hostmem: default the amount of prealloc-threads to smp-cpus · f8d426a6
    Jaroslav Jindrak authored
    
    Prior to the introduction of the prealloc-threads property, the amount
    of threads used to preallocate memory was derived from the value of
    smp-cpus passed to qemu, the amount of physical cpus of the host
    and a hardcoded maximum value. When the prealloc-threads property
    was introduced, it included a default of 1 in backends/hostmem.c and
    a default of smp-cpus using the sugar API for the property itself. The
    latter default is not used when the property is not specified on qemu's
    command line, so guests that were not adjusted for this change suddenly
    started to use the default of 1 thread to preallocate memory, which
    resulted in observable slowdowns in guest boots for guests with large
    memory (e.g. when using libvirt <8.2.0 or managing guests manually).
    
    This commit restores the original behavior for these cases while not
    impacting guests started with the prealloc-threads property in any way.
    
    Fixes: 220c1fd864e9d ("hostmem: introduce "prealloc-threads" property")
    Signed-off-by: default avatarJaroslav Jindrak <dzejrou@gmail.com>
    Message-Id: <20220517123858.7933-1-dzejrou@gmail.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    f8d426a6
    History
    hostmem: default the amount of prealloc-threads to smp-cpus
    Jaroslav Jindrak authored
    
    Prior to the introduction of the prealloc-threads property, the amount
    of threads used to preallocate memory was derived from the value of
    smp-cpus passed to qemu, the amount of physical cpus of the host
    and a hardcoded maximum value. When the prealloc-threads property
    was introduced, it included a default of 1 in backends/hostmem.c and
    a default of smp-cpus using the sugar API for the property itself. The
    latter default is not used when the property is not specified on qemu's
    command line, so guests that were not adjusted for this change suddenly
    started to use the default of 1 thread to preallocate memory, which
    resulted in observable slowdowns in guest boots for guests with large
    memory (e.g. when using libvirt <8.2.0 or managing guests manually).
    
    This commit restores the original behavior for these cases while not
    impacting guests started with the prealloc-threads property in any way.
    
    Fixes: 220c1fd864e9d ("hostmem: introduce "prealloc-threads" property")
    Signed-off-by: default avatarJaroslav Jindrak <dzejrou@gmail.com>
    Message-Id: <20220517123858.7933-1-dzejrou@gmail.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>