From: Stefan Hajnoczi <stefanha@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block: avoid unnecessary bottom halves
Date: Mon, 20 Apr 2015 17:46:58 +0100 [thread overview]
Message-ID: <20150420164658.GD32653@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1427524638-28157-1-git-send-email-pbonzini@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]
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 <pbonzini@redhat.com>
> ---
> block.c | 43 ++++++++++++++++++++++++++++++++++---------
> 1 file changed, 34 insertions(+), 9 deletions(-)
Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-04-20 16:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-28 6:37 [Qemu-devel] [PATCH] block: avoid unnecessary bottom halves Paolo Bonzini
2015-03-30 15:27 ` Stefan Hajnoczi
2015-04-20 16:46 ` Stefan Hajnoczi [this message]
2015-04-20 17:10 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150420164658.GD32653@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).