qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] block: avoid unnecessary bottom halves


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] block: avoid unnecessary bottom halves
Date: Mon, 30 Mar 2015 16:27:13 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Sat, Mar 28, 2015 at 07:37:18AM +0100, Paolo Bonzini wrote:
> bdrv_aio_* APIs can use coroutines to achieve asynchronicity.  However,
> the coroutine may terminate without having yielded back to the caller
> (for example because of something that invokes a nested event loop,
> or because the coroutine is doing nothing at all).  In this case,
> the bdrv_aio_* API must delay the completion to the next iteration
> of the main loop, because bdrv_aio_* will never invoke the callback
> before returning.
> 
> This can be done with a bottom half, and indeed bdrv_aio_* is always
> using one for simplicity.  It is possible to gain some performance
> (~3%) by avoiding this in the common case.  A new field in the
> BlockAIOCBCoroutine struct is set to true until the first time the
> corotine has yielded to its creator, and completion goes through a
> new function bdrv_co_complete.  If the flag is false, bdrv_co_complete
> invokes the callback immediately.  If it is true, the caller will
> notice that the coroutine has completed and schedule the bottom
> half itself.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  block.c | 43 ++++++++++++++++++++++++++++++++++---------
>  1 file changed, 34 insertions(+), 9 deletions(-)

Reviewed-by: Stefan Hajnoczi <address@hidden>

Attachment: pgpLkftqRS2iy.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]