From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YkEqh-0006vM-GP for qemu-devel@nongnu.org; Mon, 20 Apr 2015 12:47:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YkEqe-0006O4-A7 for qemu-devel@nongnu.org; Mon, 20 Apr 2015 12:47:07 -0400 Date: Mon, 20 Apr 2015 17:46:58 +0100 From: Stefan Hajnoczi Message-ID: <20150420164658.GD32653@stefanha-thinkpad.redhat.com> References: <1427524638-28157-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0/kgSOzhNoDC5T3a" Content-Disposition: inline In-Reply-To: <1427524638-28157-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: avoid unnecessary bottom halves List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org --0/kgSOzhNoDC5T3a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > Signed-off-by: Paolo Bonzini > --- > 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 --0/kgSOzhNoDC5T3a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVNS2CAAoJEJykq7OBq3PIiVIIAJCVMuwNgOsn8k0lbn+9zBOm WIMU9OsoNsr5E6dGXkQ4q0jbvXkEw9sGPLEWlZCakVFnH6XO2JginMRwTSn/yZf3 3kmSjLi+lvODcUOhpDyvWcucueodGGRW4+xITb32AJIKX2zR4aC3C/9nts76qsfP gnuOzQSsUJFwNgFppZzO8yVuLUOqg3VTjvgDJDA696V9u/sTJBWvSj9YdQbTkDf1 gLiWHoRT0nGFOWxZeBD1R6kH1/TDmJZE+8sV+4EqJLNe2V4JArLfjDF/5ukOzM4N hgofLwgHoYJqU/i+qc5EgqwmpCmSBm2Wwk8GkAgH6j5FPYkSNQJe/fzXPkl5xjA= =/xa+ -----END PGP SIGNATURE----- --0/kgSOzhNoDC5T3a--