qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: dzejrou@gmail.com, qemu-devel@nongnu.org
Cc: david@redhat.com, imammedo@redhat.com
Subject: Re: [PATCH] hostmem: default the amount of prealloc-threads to smp-cpus
Date: Tue, 17 May 2022 20:46:50 +0200	[thread overview]
Message-ID: <3994597b-c559-f62f-504d-3cde3493b713@redhat.com> (raw)
In-Reply-To: <20220517123858.7933-1-dzejrou@gmail.com>

On 5/17/22 14:38, dzejrou@gmail.com wrote:
> From: Jaroslav Jindrak <dzejrou@gmail.com>
> 
> 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: Jaroslav Jindrak <dzejrou@gmail.com>
> ---
>   backends/hostmem.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/backends/hostmem.c b/backends/hostmem.c
> index a7bae3d713..624bb7ecd3 100644
> --- a/backends/hostmem.c
> +++ b/backends/hostmem.c
> @@ -274,7 +274,7 @@ static void host_memory_backend_init(Object *obj)
>       backend->merge = machine_mem_merge(machine);
>       backend->dump = machine_dump_guest_core(machine);
>       backend->reserve = true;
> -    backend->prealloc_threads = 1;
> +    backend->prealloc_threads = machine->smp.cpus;
>   }
>   
>   static void host_memory_backend_post_init(Object *obj)

Queued, thanks.

Paolo


  parent reply	other threads:[~2022-05-17 18:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 12:38 [PATCH] hostmem: default the amount of prealloc-threads to smp-cpus dzejrou
2022-05-17 15:12 ` Igor Mammedov
2022-05-17 15:44   ` Jaroslav Jindrák
2022-05-17 16:33   ` Daniel P. Berrangé
2022-05-18 10:08     ` Igor Mammedov
2022-05-17 18:46 ` Paolo Bonzini [this message]
2022-05-18 10:17   ` Igor Mammedov
2022-05-18 13:02     ` Dario Faggioli
2022-05-18 13:31       ` Daniel P. Berrangé
2022-05-18 14:06         ` Paolo Bonzini
2022-05-19 13:50           ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3994597b-c559-f62f-504d-3cde3493b713@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=david@redhat.com \
    --cc=dzejrou@gmail.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).