From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2fdN-0003kT-RO for qemu-devel@nongnu.org; Thu, 03 Jul 2014 07:57:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2fdF-00014K-74 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 07:57:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2fdE-00014D-T6 for qemu-devel@nongnu.org; Thu, 03 Jul 2014 07:56:53 -0400 Message-ID: <53B544FC.7010900@redhat.com> Date: Thu, 03 Jul 2014 13:56:44 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20140627120129.GO12061@stefanha-thinkpad.muc.redhat.com> <53ADE769.3060903@redhat.com> <20140630080850.GB30969@stefanha-thinkpad.redhat.com> <53B2E69A.1090707@redhat.com> <20140702085453.GI4660@stefanha-thinkpad.redhat.com> <53B43194.80102@redhat.com> <53B5308F.3030008@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [regression] dataplane: throughout -40% by commit 580b6b2aa2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ming Lei Cc: Kevin Wolf , Fam Zheng , "Michael S. Tsirkin" , Stefan Hajnoczi , qemu-devel , Stefan Hajnoczi Il 03/07/2014 13:50, Ming Lei ha scritto: >> Yes, you can just move the atomic_inc/atomic_dec in aio_poll. > > If you mean move inc/dec of 'running' in aio_poll, that won't work. > When aio_notify() sees 'running', it won't set notifier, and may > trap to ppoll(). I mean move it to aio_poll, around the second invocation of aio_dispatch. IIRC the first invocation of aio_dispatch is only used when AioContext is running as a GSource. It should never run for dataplane, so it's okay if we only trap aio_notify from the second aio_dispatch(). In 2.2, we should rewrite aio_poll() to follow the prepare/poll/check/dispatch model of glib. Then the optimization becomes much simpler (you only call aio_dispatch once) and it also works for GSource mode. Stefan convinced me to send the patch myself, so I will do it now. Paolo