From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlyDX-0007e3-2p for qemu-devel@nongnu.org; Wed, 05 Nov 2014 05:53:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlyDQ-00068z-TI for qemu-devel@nongnu.org; Wed, 05 Nov 2014 05:53:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlyDQ-00068v-Li for qemu-devel@nongnu.org; Wed, 05 Nov 2014 05:53:28 -0500 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 sA5ArSAu022852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 5 Nov 2014 05:53:28 -0500 Message-ID: <545A01A3.3070206@redhat.com> Date: Wed, 05 Nov 2014 11:53:23 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1414395048-16006-1-git-send-email-famz@redhat.com> <1414395048-16006-3-git-send-email-famz@redhat.com> In-Reply-To: <1414395048-16006-3-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3 2/2] main-loop: Use epoll on Linux List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: kwolf@redhat.com, Stefan Hajnoczi On 27/10/2014 08:30, Fam Zheng wrote: > > +static int epoll_prepare(int epollfd, > + GPollFD *fds, guint nfds, > + GPollFD **g_poll_fds, > + guint *g_poll_nfds, > + int **g_poll_fd_idx) Please pass the QEMUPollContext to epoll_prepare. > + if (ctx->last_fds) { > + close(ctx->epollfd); > + } > + ctx->epollfd = epoll_create(1); Please use epoll_create1 with the EPOLL_CLOEXEC flag. > + if (ctx->epollfd < 0) { > + perror("epoll_create"); > + abort(); > + } Interesting. Is it cheaper to do this than to compute a symmetric difference? I am worried that the epoll_create fails with EMFILE, and that the destruction/recreation happens often with networking (which uses qemu_set_fd_handler2) if you use the right workload. Paolo