SHA256
1
0
forked from pool/qemu
qemu/0025-AIO-Reduce-number-of-threads-for-32.patch
Andreas Färber 724a14a256 Accepting request 487699 from home:bfrogers:branches:Virtualization
Update to rc4 of v2.9.0. Also includes a few other fixes, and a number of tweaks to the spec files. I'd be happy to answer any questions about all those spec file changes, I believe they were all in the direction of a more correct and maintainable spec file. Since this is still in rc phase, let's keep it in devel project. Final release should appear in time for Beta2 of SLE12SP3. Delta from previous: Added Alex's patch for keyboard empty event.

OBS-URL: https://build.opensuse.org/request/show/487699
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=334
2017-04-12 19:10:15 +00:00

41 lines
1.3 KiB
Diff

From a511e713d55d924531525a332170c10c12a53ec8 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 14 Jan 2015 01:32:11 +0100
Subject: [PATCH] AIO: Reduce number of threads for 32bit hosts
On hosts with limited virtual address space (32bit pointers), we can very
easily run out of virtual memory with big thread pools.
Instead, we should limit ourselves to small pools to keep memory footprint
low on those systems.
This patch fixes random VM stalls like
(process:25114): GLib-ERROR **: gmem.c:103: failed to allocate 1048576 bytes
on 32bit ARM systems for me.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
util/thread-pool.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/util/thread-pool.c b/util/thread-pool.c
index 610646d131..2e34e9846d 100644
--- a/util/thread-pool.c
+++ b/util/thread-pool.c
@@ -308,7 +308,12 @@ static void thread_pool_init_one(ThreadPool *pool, AioContext *ctx)
qemu_mutex_init(&pool->lock);
qemu_cond_init(&pool->worker_stopped);
qemu_sem_init(&pool->sem, 0);
- pool->max_threads = 64;
+ if (sizeof(pool) == 4) {
+ /* 32bit systems run out of virtual memory quickly */
+ pool->max_threads = 4;
+ } else {
+ pool->max_threads = 64;
+ }
pool->new_thread_bh = aio_bh_new(ctx, spawn_thread_bh_fn, pool);
QLIST_INIT(&pool->head);