[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/17] hostmem: default the amount of prealloc-threads to smp-cpus
From: |
Paolo Bonzini |
Subject: |
[PULL 02/17] hostmem: default the amount of prealloc-threads to smp-cpus |
Date: |
Wed, 25 May 2022 21:28:37 +0200 |
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>
Message-Id: <20220517123858.7933-1-dzejrou@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.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)
--
2.36.1
- [PULL 00/17] Misc patches for 2022-05-25, Paolo Bonzini, 2022/05/25
- [PULL 01/17] target/i386: Remove LBREn bit check when access Arch LBR MSRs, Paolo Bonzini, 2022/05/25
- [PULL 02/17] hostmem: default the amount of prealloc-threads to smp-cpus,
Paolo Bonzini <=
- [PULL 03/17] thread-pool: optimize scheduling of completion bottom half, Paolo Bonzini, 2022/05/25
- [PULL 04/17] thread-pool: replace semaphore with condition variable, Paolo Bonzini, 2022/05/25
- [PULL 05/17] thread-pool: remove stopping variable, Paolo Bonzini, 2022/05/25
- [PULL 06/17] contrib/elf2dmp: add ELF dump header checking, Paolo Bonzini, 2022/05/25
- [PULL 08/17] hw/audio/ac97: Remove unimplemented reset functions, Paolo Bonzini, 2022/05/25
- [PULL 07/17] hw/audio/ac97: Coding style fixes to avoid checkpatch errors, Paolo Bonzini, 2022/05/25
- [PULL 09/17] hw/audio/ac97: Remove unneeded local variables, Paolo Bonzini, 2022/05/25
- [PULL 10/17] target/i386/kvm: Fix disabling MPX on "-cpu host" with MPX-capable host, Paolo Bonzini, 2022/05/25
- [PULL 11/17] ide_ioport_read: Return lower octet of data register instead of 0xFF, Paolo Bonzini, 2022/05/25
- [PULL 12/17] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES, Paolo Bonzini, 2022/05/25