From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDA6x-0006Af-G9 for qemu-devel@nongnu.org; Wed, 15 Jun 2016 08:40:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDA6s-0008U7-K6 for qemu-devel@nongnu.org; Wed, 15 Jun 2016 08:39:58 -0400 References: <1465989402-18890-1-git-send-email-kwolf@redhat.com> From: Paolo Bonzini Message-ID: <09f6dd09-0784-b3ad-95ff-5e7d1eb12969@redhat.com> Date: Wed, 15 Jun 2016 14:39:42 +0200 MIME-Version: 1.0 In-Reply-To: <1465989402-18890-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] linux-aio: Cancel BH if not needed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: stefanha@redhat.com, qemu-devel@nongnu.org On 15/06/2016 13:16, Kevin Wolf wrote: > linux-aio uses a BH in order to make sure that the remaining completions > are processed even in nested event loops of completion callbacks in > order to avoid deadlocks. > > There is no need, however, to have the BH overhead for the first call > into qemu_laio_completion_bh() or after all pending completions have > already been processed. Therefore, this patch calls directly into > qemu_laio_completion_bh() in qemu_laio_completion_cb() and cancels > the BH after qemu_laio_completion_bh() has processed all pending > completions. > > Signed-off-by: Kevin Wolf > --- > block/linux-aio.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/block/linux-aio.c b/block/linux-aio.c > index fe7cece..e468960 100644 > --- a/block/linux-aio.c > +++ b/block/linux-aio.c > @@ -149,6 +149,8 @@ static void qemu_laio_completion_bh(void *opaque) > if (!s->io_q.plugged && !QSIMPLEQ_EMPTY(&s->io_q.pending)) { > ioq_submit(s); > } > + > + qemu_bh_cancel(s->completion_bh); > } > > static void qemu_laio_completion_cb(EventNotifier *e) > @@ -156,7 +158,7 @@ static void qemu_laio_completion_cb(EventNotifier *e) > LinuxAioState *s = container_of(e, LinuxAioState, e); > > if (event_notifier_test_and_clear(&s->e)) { > - qemu_bh_schedule(s->completion_bh); > + qemu_laio_completion_bh(s); > } > } > > Reviewed-by: Paolo Bonzini