Received: from eggs.gnu.org ([2001:4830:134:3::10]:33589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXKGQ-000616-KH for qemu-devel@nongnu.org; Thu, 25 Sep 2014 21:24:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXKGK-0008AZ-Em for qemu-devel@nongnu.org; Thu, 25 Sep 2014 21:24:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19583) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXKGK-00088R-7B for qemu-devel@nongnu.org; Thu, 25 Sep 2014 21:23:56 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8Q1NoGY027605 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 25 Sep 2014 21:23:50 -0400 Date: Fri, 26 Sep 2014 09:23:51 +0800 From: Fam Zheng Message-ID: <20140926012351.GA1680@fam-t430.nay.redhat.com> References: <1411665709-2052-1-git-send-email-famz@redhat.com> <1411665709-2052-3-git-send-email-famz@redhat.com> <542470E4.6060402@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <542470E4.6060402@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/2] iohandler: Add Linux implementation of iohandler GSource List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On Thu, 09/25 21:45, Paolo Bonzini wrote: > Il 25/09/2014 19:21, Fam Zheng ha scritto: > > + while (true) { > > + r = epoll_pwait(s->epollfd.fd, events, MAX_EVENTS, 0, &origmask); > > You can save a syscall by doing this just once. You would just get a > readable epoll file descriptor on the next main loop iteration. There is only one call here if r < MAX_EVENTS, which is the normal case. > Also, > origmask is an input parameter, so you need to use epoll_wait. Yeah, I missed the point completely. :p > > Also, as an extra optimization perhaps you can make a second list with > iohandlers that were modified or have a read_poll handler, and only call > iohandler_get_events on that one. Sounds good, but I need to benchmark it to tell :) There isn't a lot of computation if there is no read_poll. > > Perhaps this together lowers the cost of epoll enough to more easily > reach the break-even point. Dynamic swithing between ppoll and epoll shoudn't be hard to implement, but I'm not sure how to write the condition. Anyway, do you think it is a good idea? Fam > > Though I wonder if it would be acceptable to make ioeventfd off by > default for virtio-serial... > > Thanks, > > Paolo