diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2022-02-15 19:30:33 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2022-02-15 19:30:33 +0000 |
| commit | ad38520bdeb2b1e0b487db317f29119e94c1c88d (patch) | |
| tree | 9343700c0a3ced0b8e6f2a179872164631165a65 /util/qemu-coroutine.c | |
| parent | cc6721e449c4c5a9a5007ad8a810f7f54143eadc (diff) | |
| parent | 4c41c69e05fe28c0f95f8abd2ebf407e95a4f04b (diff) | |
| download | focaccia-qemu-ad38520bdeb2b1e0b487db317f29119e94c1c88d.tar.gz focaccia-qemu-ad38520bdeb2b1e0b487db317f29119e94c1c88d.zip | |
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/block-pull-request' into staging
Pull request This contains coroutine poll size scaling, virtiofsd rseq seccomp for new glibc versions, and the QEMU C virtiofsd deprecation notice. # gpg: Signature made Mon 14 Feb 2022 17:14:21 GMT # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha-gitlab/tags/block-pull-request: util: adjust coroutine pool size to virtio block queue Deprecate C virtiofsd tools/virtiofsd: Add rseq syscall to the seccomp allowlist Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/qemu-coroutine.c')
| -rw-r--r-- | util/qemu-coroutine.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c index 38fb6d3084..c03b2422ff 100644 --- a/util/qemu-coroutine.c +++ b/util/qemu-coroutine.c @@ -20,12 +20,14 @@ #include "qemu/coroutine_int.h" #include "block/aio.h" +/** Initial batch size is 64, and is increased on demand */ enum { - POOL_BATCH_SIZE = 64, + POOL_INITIAL_BATCH_SIZE = 64, }; /** Free list to speed up creation */ static QSLIST_HEAD(, Coroutine) release_pool = QSLIST_HEAD_INITIALIZER(pool); +static unsigned int pool_batch_size = POOL_INITIAL_BATCH_SIZE; static unsigned int release_pool_size; static __thread QSLIST_HEAD(, Coroutine) alloc_pool = QSLIST_HEAD_INITIALIZER(pool); static __thread unsigned int alloc_pool_size; @@ -49,7 +51,7 @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque) if (CONFIG_COROUTINE_POOL) { co = QSLIST_FIRST(&alloc_pool); if (!co) { - if (release_pool_size > POOL_BATCH_SIZE) { + if (release_pool_size > qatomic_read(&pool_batch_size)) { /* Slow path; a good place to register the destructor, too. */ if (!coroutine_pool_cleanup_notifier.notify) { coroutine_pool_cleanup_notifier.notify = coroutine_pool_cleanup; @@ -86,12 +88,12 @@ static void coroutine_delete(Coroutine *co) co->caller = NULL; if (CONFIG_COROUTINE_POOL) { - if (release_pool_size < POOL_BATCH_SIZE * 2) { + if (release_pool_size < qatomic_read(&pool_batch_size) * 2) { QSLIST_INSERT_HEAD_ATOMIC(&release_pool, co, pool_next); qatomic_inc(&release_pool_size); return; } - if (alloc_pool_size < POOL_BATCH_SIZE) { + if (alloc_pool_size < qatomic_read(&pool_batch_size)) { QSLIST_INSERT_HEAD(&alloc_pool, co, pool_next); alloc_pool_size++; return; @@ -202,3 +204,13 @@ AioContext *coroutine_fn qemu_coroutine_get_aio_context(Coroutine *co) { return co->ctx; } + +void qemu_coroutine_increase_pool_batch_size(unsigned int additional_pool_size) +{ + qatomic_add(&pool_batch_size, additional_pool_size); +} + +void qemu_coroutine_decrease_pool_batch_size(unsigned int removing_pool_size) +{ + qatomic_sub(&pool_batch_size, removing_pool_size); +} |