From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LASAR-0001sB-Jx for qemu-devel@nongnu.org; Wed, 10 Dec 2008 11:44:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LASAQ-0001rz-Tj for qemu-devel@nongnu.org; Wed, 10 Dec 2008 11:44:07 -0500 Received: from [199.232.76.173] (port=57643 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LASAQ-0001rw-NZ for qemu-devel@nongnu.org; Wed, 10 Dec 2008 11:44:06 -0500 Received: from mx2.redhat.com ([66.187.237.31]:52768) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LASAQ-00063r-9r for qemu-devel@nongnu.org; Wed, 10 Dec 2008 11:44:06 -0500 Date: Wed, 10 Dec 2008 17:44:01 +0100 From: Andrea Arcangeli Subject: Re: [Qemu-devel] [RFC] Replace posix-aio with custom thread pool Message-ID: <20081210164401.GF18814@random.random> References: <1228512061-25398-1-git-send-email-aliguori@us.ibm.com> <493E941D.4000608@redhat.com> <493E965E.5050701@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <493E965E.5050701@us.ibm.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , kvm-devel On Tue, Dec 09, 2008 at 10:01:34AM -0600, Anthony Liguori wrote: > Yes, that's what I'm going to do before committing it. I've been hacking on this too, just to push out a full tested patchset without the _em badness... problem is if we use more than one thread, there's a thread race between lseek and writev, pread/pwrite don't have the issue as they store the pos on the kernel stack, and they don't pass through the shared file->f_pos. We'd really need preadv/pwritev... To solve this in userland without kernel aio we'd need to open (not just dup) the file in each thread, then the file->f_pos will become thread local and we can cache the last lseek value and avoid the lseek syscall for contiguous I/O. Or we need to reduce the number of threads to 1 per fd (screwing seeking I/O). kernel aio wouldn't have this trouble and a single fd/file would be enough, but that would only work on linux.