All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thread-pool: signal condition variable while holding lock
@ 2026-03-30 13:01 Stepan Popov
  2026-03-30 13:43 ` Daniel P. Berrangé
  2026-03-30 16:33 ` Paolo Bonzini
  0 siblings, 2 replies; 5+ messages in thread
From: Stepan Popov @ 2026-03-30 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Paolo Bonzini, Stepan Popov

Move qemu_cond_signal() inside the critical section protected by pool->lock.
Signaling while holding the lock imposes more predictable scheduling behavior.

Signed-off-by: Stepan Popov <Stepan.Popov@kaspersky.com>
---
 util/thread-pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/thread-pool.c b/util/thread-pool.c
index 8f8cb38d5c..8e55aefd07 100644
--- a/util/thread-pool.c
+++ b/util/thread-pool.c
@@ -265,8 +265,8 @@ BlockAIOCB *thread_pool_submit_aio(ThreadPoolFunc *func, void *arg,
         spawn_thread(pool);
     }
     QTAILQ_INSERT_TAIL(&pool->request_list, req, reqs);
-    qemu_mutex_unlock(&pool->lock);
     qemu_cond_signal(&pool->request_cond);
+    qemu_mutex_unlock(&pool->lock);
     return &req->common;
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-10 16:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 13:01 [PATCH] thread-pool: signal condition variable while holding lock Stepan Popov
2026-03-30 13:43 ` Daniel P. Berrangé
2026-03-30 15:55   ` Stepan Popov
2026-03-30 16:33 ` Paolo Bonzini
2026-04-10 16:20   ` Stepan Popov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.