On Tue, May 17, 2022 at 5:20 PM Stefan Hajnoczi wrote:
>
> On Sat, May 14, 2022 at 08:50:11AM +0200, Paolo Bonzini wrote:
> > @@ -134,6 +122,12 @@ static void *worker_thread(void *opaque)
> > pool->cur_threads--;
> > qemu_cond_signal(&pool->worker_stopped);
> > qemu_mutex_unlock(&po
On Sat, May 14, 2022 at 08:50:11AM +0200, Paolo Bonzini wrote:
> @@ -134,6 +122,12 @@ static void *worker_thread(void *opaque)
> pool->cur_threads--;
> qemu_cond_signal(&pool->worker_stopped);
> qemu_mutex_unlock(&pool->lock);
> +
> +/*
> + * Wake up another thread, in case w
On 5/17/22 14:46, Nicolas Saenz Julienne wrote:
-while (!pool->stopping) {
+while (!pool->stopping && pool->cur_threads <= pool->max_threads) {
ThreadPoolElement *req;
int ret;
-do {
+if (QTAILQ_EMPTY(&pool->request_list)) {
pool->idle
On Tue, 2022-05-17 at 16:18 +0200, Paolo Bonzini wrote:
> On 5/17/22 14:46, Nicolas Saenz Julienne wrote:
> > > -while (!pool->stopping) {
> > > +while (!pool->stopping && pool->cur_threads <= pool->max_threads) {
> > > ThreadPoolElement *req;
> > > int ret;
> > >
> >
Hi Paolo,
On Sat, 2022-05-14 at 08:50 +0200, Paolo Bonzini wrote:
[...]
> static void *worker_thread(void *opaque)
> {
> ThreadPool *pool = opaque;
> @@ -99,20 +82,25 @@ static void *worker_thread(void *opaque)
> pool->pending_threads--;
> do_spawn_thread(pool);
>
> -while
Since commit f9fc8932b1 ("thread-posix: remove the posix semaphore
support", 2022-04-06) QemuSemaphore has its own mutex and condition
variable; this adds unnecessary overhead on I/O with small block sizes.
Check the QTAILQ directly instead of adding the indirection of a
semaphore's count. Using