From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KiQHb-0007vO-Jd for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:03:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KiQHZ-0007um-Vr for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:03:39 -0400 Received: from [199.232.76.173] (port=36381 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiQHZ-0007ud-NJ for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:03:37 -0400 Received: from mx2.redhat.com ([66.187.237.31]:57341) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KiQHY-0004LN-H5 for qemu-devel@nongnu.org; Wed, 24 Sep 2008 05:03:37 -0400 Message-ID: <48DA021F.2050504@redhat.com> Date: Wed, 24 Sep 2008 12:02:23 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1222202051-26701-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1222202051-26701-1-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] Implement an fd pool to get real AIO with posix-aio Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Ryan Harper , qemu-devel@nongnu.org, kvm Anthony Liguori wrote: > This patch implements a simple fd pool to allow many AIO requests with > posix-aio. The result is significantly improved performance (identical to that > reported for linux-aio) for both cache=on and cache=off. > > The fundamental problem with posix-aio is that it limits itself to one thread > per-file descriptor. I don't know why this is, but this patch provides a simple > mechanism to work around this (duplicating the file descriptor). > > This isn't a great solution, but it seems like a reasonable intermediate step > between posix-aio and a custom thread-pool to replace it. > > > +static int raw_fd_pool_get(BDRVRawState *s) > +{ > + int i; > + > + for (i = 0; i < RAW_FD_POOL_SIZE; i++) { > + /* already in use */ > + if (s->fd_pool[i] != -1) > + continue; > + > + /* try to dup file descriptor */ > + s->fd_pool[i] = dup(s->fd); > + if (s->fd_pool[i] != -1) > + return s->fd_pool[i]; > + } > + > + /* we couldn't dup the file descriptor so just use the main one */ > + return s->fd; > +} > + > dup()ing the fd on each request is unnecessary work; would be better to cache the duped fd. Of course, if this is just a stepping stone, it doesn't matter very much. -- error compiling committee.c: too many arguments to function