From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: [Qemu-devel] [RFC] Replace posix-aio with custom thread pool Date: Wed, 10 Dec 2008 17:44:01 +0100 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 Cc: Gerd Hoffmann , kvm-devel To: qemu-devel@nongnu.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:55711 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755849AbYLJQoG (ORCPT ); Wed, 10 Dec 2008 11:44:06 -0500 Content-Disposition: inline In-Reply-To: <493E965E.5050701@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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.