From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56587 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGSiu-0004wq-EM for qemu-devel@nongnu.org; Thu, 11 Nov 2010 03:41:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGSit-0006Ud-A8 for qemu-devel@nongnu.org; Thu, 11 Nov 2010 03:41:36 -0500 Received: from mail-fx0-f45.google.com ([209.85.161.45]:44800) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGSit-0006UW-3K for qemu-devel@nongnu.org; Thu, 11 Nov 2010 03:41:35 -0500 Received: by fxm18 with SMTP id 18so1197499fxm.4 for ; Thu, 11 Nov 2010 00:41:34 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4CDBAC38.4080901@redhat.com> Date: Thu, 11 Nov 2010 09:41:28 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20101110131822.29714.34137.stgit@localhost6.localdomain6> <20101110131946.29714.98218.stgit@localhost6.localdomain6> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/3] Make paio subsystem use threadlets infrastructure List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Arun R Bharadwaj , qemu-devel@nongnu.org On 11/10/2010 02:45 PM, Stefan Hajnoczi wrote: > I wonder if the condition variable has a measurable performance > overhead. We unconditionally broadcast on paiocb completion. One > idea would be to keep a counter of waiters (should only ever be 0 or > 1) protected by aiocb_mutex and broadcast only when there is a waiter. This should be handled anyway by the pthreads library. If we are sure there is only one waiter at most, you can change broadcast to signal but that would already be microoptimization. Alternatively, you can use futexes to implement a completion signal (similar to Win32 events). But it seems too much effort. Paolo