From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFx6d-0007w8-4r for qemu-devel@nongnu.org; Fri, 17 Jul 2015 00:18:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFx6Z-0000n3-PW for qemu-devel@nongnu.org; Fri, 17 Jul 2015 00:18:38 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:36448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFx6Z-0000mx-Il for qemu-devel@nongnu.org; Fri, 17 Jul 2015 00:18:35 -0400 Received: by wgxm20 with SMTP id m20so72815727wgx.3 for ; Thu, 16 Jul 2015 21:17:50 -0700 (PDT) Sender: Paolo Bonzini References: <1437040609-9878-1-git-send-email-pbonzini@redhat.com> <1437040609-9878-4-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: <55A881EB.1040500@redhat.com> Date: Fri, 17 Jul 2015 06:17:47 +0200 MIME-Version: 1.0 In-Reply-To: <1437040609-9878-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/3] AioContext: fix broken ctx->dispatching optimization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, lersek@redhat.com, rjones@redhat.com, stefanha@redhat.com On 16/07/2015 11:56, Paolo Bonzini wrote: > @@ -286,13 +283,15 @@ bool aio_poll(AioContext *ctx, bool blocking) > npfd = 0; > ctx->walking_handlers--; > > + if (blocking) { > + atomic_sub(&ctx->notify_me, 2); > + } > + I kept this place for subtracting notify_me because it is the same place where aio_set_dispatching was called. However, it can be anticipated to /* if we have any readable fds, dispatch event */ if (ret > 0) { for (i = 0; i < npfd; i++) { i.e. right after poll. As poll has exited, it can't be blocking the thread anymore. Stefan, please let me send v3 on Monday. Paolo > > /* Run dispatch even if there were no readable fds to run timers */ > - aio_set_dispatching(ctx, true); > if (aio_dispatch(ctx)) { > progress = true; > } >