[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/6] aiopool: protect with a mutex
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 6/6] aiopool: protect with a mutex |
Date: |
Wed, 12 May 2021 16:19:38 +0100 |
On Mon, May 10, 2021 at 10:59:41AM +0200, Emanuele Giuseppe Esposito wrote:
> Divide the fields in AioTaskPool in IN and Status, and
> introduce a CoQueue instead of .wait to take care of suspending
> and resuming the calling coroutine, and a lock to protect the
> busy_tasks counter accesses and the AioTask .ret field.
The thread-safety concerns with the aio_task.h API are unclear to me.
The API is designed to have a "main" coroutine that adds task
functions to the pool and waits for them to complete. Task functions
execute in coroutines (up to the pool's max_busy_tasks limit).
It seems like the API was designed to be called only from its main
coroutine so why make everything thread-safe? Is there a caller that
shares an AioTaskPool between threads? Or will the task functions switch
threads somehow?
What exactly is the new thread-safety model? Please document it.
Unfortunately aio_task.h doesn't have doc comments already but it will
be necessary if there are thread-safety concerns.
signature.asc
Description: PGP signature
[PATCH 2/6] block-copy: let ratelimit handle a speed of 0, Emanuele Giuseppe Esposito, 2021/05/10
[PATCH 6/6] aiopool: protect with a mutex, Emanuele Giuseppe Esposito, 2021/05/10
Re: [PATCH 0/6] block-copy: make helper APIs thread safe, Vladimir Sementsov-Ogievskiy, 2021/05/10
Re: [PATCH 0/6] block-copy: make helper APIs thread safe, Stefan Hajnoczi, 2021/05/12