From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsRbw-0007Ap-8j for qemu-devel@nongnu.org; Sat, 13 Aug 2011 23:43:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QsRbv-0008Vn-Aj for qemu-devel@nongnu.org; Sat, 13 Aug 2011 23:43:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsRbv-0008Vj-03 for qemu-devel@nongnu.org; Sat, 13 Aug 2011 23:43:39 -0400 Message-ID: <4E474460.2060803@redhat.com> Date: Sat, 13 Aug 2011 20:43:28 -0700 From: Avi Kivity MIME-Version: 1.0 References: <1312803458-2272-1-git-send-email-avi@redhat.com> <4E452994.9080805@codemonkey.ws> In-Reply-To: <4E452994.9080805@codemonkey.ws> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] posix-aio-compat: fix latency issues List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , qemu-devel@nongnu.org, kvm@vger.kernel.org On 08/12/2011 06:24 AM, Anthony Liguori wrote: > On 08/08/2011 06:37 AM, Avi Kivity wrote: >> >> +static void spawn_thread_bh_fn(void *opaque) >> +{ >> + mutex_lock(&lock); >> + do_spawn_thread(); >> + mutex_unlock(&lock); >> +} > > The locking here is odd. Why not call do_spawn_thread() without the > lock, and acquire the lock for the section that needs to hold it? Just the way the code evolved. Note that aio_thread() does need to take the lock. However, it is indeed cleaner to take the lock when needed rather than drop it when not. > > Otherwise, the logic seems correct to me. > > Kevin, could you also take a look at this patch? Yes please. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.