From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187AbbJOVCA (ORCPT ); Thu, 15 Oct 2015 17:02:00 -0400 Received: from g1t6214.austin.hp.com ([15.73.96.122]:40369 "EHLO g1t6214.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751925AbbJOVB7 (ORCPT ); Thu, 15 Oct 2015 17:01:59 -0400 Message-ID: <56201443.70406@hpe.com> Date: Thu, 15 Oct 2015 17:01:55 -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: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch , Davidlohr Bueso Subject: Re: [PATCH v7 4/5] locking/pvqspinlock: Allow 1 lock stealing attempt References: <1442955044-43895-1-git-send-email-Waiman.Long@hpe.com> <1442955044-43895-5-git-send-email-Waiman.Long@hpe.com> <20151013195627.GY3816@twins.programming.kicks-ass.net> <561D6E91.90703@hpe.com> <20151014092814.GA3816@twins.programming.kicks-ass.net> In-Reply-To: <20151014092814.GA3816@twins.programming.kicks-ass.net> 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 On 10/14/2015 05:28 AM, Peter Zijlstra wrote: > On Tue, Oct 13, 2015 at 04:50:25PM -0400, Waiman Long wrote: >> On 10/13/2015 03:56 PM, Peter Zijlstra wrote: >>> So the below is exactly duplicated from the normal slowpath, so why >>> don't you keep that there? >>> >>> It would get you something like: >>> >>> if (pv_wait_head_or_steal(..)) >>> goto stolen; >>> >>> >>> stolen: >>>> + /* >>>> + * contended path; wait for next, release. >>>> + */ >>>> + while (!(next = READ_ONCE(node->next))) >>>> + cpu_relax(); >>>> + >>>> + arch_mcs_spin_unlock_contended(&next->locked); >>>> + pv_kick_node(lock, next); >>> release: >>> ... >> Yes, it is largely the same. I thought that you don't like too much change >> in the logic flow of the generic qspinlock code. I will make the change in >> the next revision. > Well, you already put the branch in there, the only difference here is > an 'extra' label. OTOH that extra label avoids duplicating some hairy > code. So over all I would say its a definite win. > > And its easy to see it will compile away on the native case where: > > #define pv_wait_head_or_steal(l, n, t) (false) > > I have done it in a different way to avoid duplicating code. I think I am not going to use the pv_wait_head_or_steal name after all as I don't consider acquiring the lock by the queue head CPU is lock stealing. I will skip "and" and name it as pv_wait_head_lock instead. Please let me know if you have a better idea. Cheers, Longman