Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753231AbbDASyz (ORCPT ); Wed, 1 Apr 2015 14:54:55 -0400 Received: from g2t2353.austin.hp.com ([15.217.128.52]:56490 "EHLO g2t2353.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799AbbDASyx (ORCPT ); Wed, 1 Apr 2015 14:54:53 -0400 X-Greylist: delayed 17158 seconds by postgrey-1.27 at vger.kernel.org; Wed, 01 Apr 2015 14:54:53 EDT Message-ID: <551C3EF5.6090809@hp.com> Date: Wed, 01 Apr 2015 14:54:45 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Peter Zijlstra CC: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, paolo.bonzini@gmail.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, paulmck@linux.vnet.ibm.com, riel@redhat.com, torvalds@linux-foundation.org, raghavendra.kt@linux.vnet.ibm.com, david.vrabel@citrix.com, oleg@redhat.com, scott.norton@hp.com, doug.hatch@hp.com, linux-arch@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, luto@amacapital.net Subject: Re: [PATCH 8/9] qspinlock: Generic paravirt support 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> In-Reply-To: <20150401181744.GE32047@worktop.ger.corp.intel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1161 Lines: 28 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/