From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 8/8 v2] Change irq_lock from mutex to spinlock. Date: Wed, 12 Aug 2009 12:22:34 +0300 Message-ID: <4A8289DA.8000806@redhat.com> References: <1249993895-11119-1-git-send-email-gleb@redhat.com> <1249993895-11119-9-git-send-email-gleb@redhat.com> <4A827D4C.6070709@redhat.com> <20090812091108.GA4764@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:56582 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932210AbZHLJWg (ORCPT ); Wed, 12 Aug 2009 05:22:36 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7C9MbQB024529 for ; Wed, 12 Aug 2009 05:22:37 -0400 In-Reply-To: <20090812091108.GA4764@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/12/2009 12:11 PM, Gleb Natapov wrote: > On Wed, Aug 12, 2009 at 11:29:00AM +0300, Avi Kivity wrote: > >> On 08/11/2009 03:31 PM, Gleb Natapov wrote: >> >>> Change irq_lock from mutex to spinlock. We do not sleep while holding >>> it. >>> >>> >> But why change? >> >> > Isn't it more lightweight? For the remaining use of the lock it doesn't > really matters, but if I see mutex used somewhere I assume there are > users that sleeps. > Before the recent change, a mutex was more expensive if there was contention (waiter would schedule out). Recently the mutex code was changed to spin while the holder was running. >> The only motivation I can see is to allow injection from irqfd and >> interrupt contexts without requiring a tasklet/work. But that needs >> spin_lock_irqsave(), not spin_lock(). >> >> > After this series the lock is used only to protect modification of irq > table, add/delete of ack notifiers and irq source id allocator. None of > this affects injection from irqfd. > > Then it can be definitely left as mutex. -- error compiling committee.c: too many arguments to function