From mboxrd@z Thu Jan 1 00:00:00 1970 From: Waiman Long Subject: Re: [PATCH 8/9] qspinlock: Generic paravirt support Date: Wed, 01 Apr 2015 14:54:45 -0400 Message-ID: <551C3EF5.6090809__38818.2899020196$1427914626$gmane$org@hp.com> References: <20150316131613.720617163@infradead.org> <20150316133112.278511476@infradead.org> <5509E51D.7040909@hp.com> <20150319101242.GM21418@twins.programming.kicks-ass.net> <20150319122536.GD11574@worktop.ger.corp.intel.com> <551C1ACE.4090408@hp.com> <20150401171223.GO23123@twins.programming.kicks-ass.net> <20150401174239.GO24151@twins.programming.kicks-ass.net> <20150401181744.GE32047@worktop.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YdNmy-0005Xb-6M for xen-devel@lists.xenproject.org; Wed, 01 Apr 2015 18:54:56 +0000 In-Reply-To: <20150401181744.GE32047@worktop.ger.corp.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Peter Zijlstra Cc: linux-arch@vger.kernel.org, riel@redhat.com, x86@kernel.org, kvm@vger.kernel.org, scott.norton@hp.com, raghavendra.kt@linux.vnet.ibm.com, paolo.bonzini@gmail.com, oleg@redhat.com, linux-kernel@vger.kernel.org, mingo@redhat.com, david.vrabel@citrix.com, hpa@zytor.com, luto@amacapital.net, xen-devel@lists.xenproject.org, tglx@linutronix.de, paulmck@linux.vnet.ibm.com, torvalds@linux-foundation.org, boris.ostrovsky@oracle.com, virtualization@lists.linux-foundation.org, doug.hatch@hp.com List-Id: xen-devel@lists.xenproject.org On 04/01/2015 02:17 PM, Peter Zijlstra wrote: > On Wed, Apr 01, 2015 at 07:42:39PM +0200, Peter Zijlstra wrote: >>> Hohumm.. time to think more I think ;-) >> So bear with me, I've not really pondered this well so it could be full >> of holes (again). >> >> After the cmpxchg(&l->locked, _Q_LOCKED_VAL, _Q_SLOW_VAL) succeeds the >> spin_unlock() must do the hash lookup, right? We can make the lookup >> unhash. >> >> If the cmpxchg() fails the unlock will not do the lookup and we must >> unhash. > The idea being that the result is that any lookup is guaranteed to find > an entry, which reduces our worst case lookup cost to whatever the worst > case insertion cost was. > I think it doesn't matter who did the unhashing. Multiple independent locks can be hashed to the same value. Since they can be unhashed independently, there is no way to know whether you have checked all the possible buckets. -Longman