Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751952AbbKITxy (ORCPT ); Mon, 9 Nov 2015 14:53:54 -0500 Received: from g2t4621.austin.hp.com ([15.73.212.80]:36669 "EHLO g2t4621.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbbKITxx (ORCPT ); Mon, 9 Nov 2015 14:53:53 -0500 Message-ID: <5640F9B9.7090306@hpe.com> Date: Mon, 09 Nov 2015 14:53:29 -0500 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 tip/locking/core v9 5/6] locking/pvqspinlock: Allow 1 lock stealing attempt References: <1446247597-61863-1-git-send-email-Waiman.Long@hpe.com> <1446247597-61863-6-git-send-email-Waiman.Long@hpe.com> <20151106145005.GU17308@twins.programming.kicks-ass.net> <563CE7C5.9020508@hpe.com> <20151109172945.GM17308@twins.programming.kicks-ass.net> In-Reply-To: <20151109172945.GM17308@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 Content-Length: 1782 Lines: 53 On 11/09/2015 12:29 PM, Peter Zijlstra wrote: > On Fri, Nov 06, 2015 at 12:47:49PM -0500, Waiman Long wrote: >> On 11/06/2015 09:50 AM, Peter Zijlstra wrote: >>> *urgh*, last time we had: >>> >>> + if (pv_wait_head_or_steal()) >>> + goto stolen; >>> while ((val = smp_load_acquire(&lock->val.counter))& _Q_LOCKED_PENDING_MASK) >>> cpu_relax(); >>> >>> ... >>> >>> +stolen: >>> while (!(next = READ_ONCE(node->next))) >>> cpu_relax(); >>> >>> ... >>> >>> Now you completely overhaul the native code.. what happened? >> I want to reuse as much of the existing native code as possible instead of >> duplicating that in the PV function. The only difference now is that the PV >> function will acquire that lock. > Right; and while I doubt it hurts the native case (you did benchmark it > I hope), I'm not too keen on the end result code wise. > > Maybe just keep the above. I can jump over the smp_load_acquire() for PV instead of adding an additional if block. For the native code, the only thing that was added was an additional masking of val with _Q_TAIL_MASK which I don't think will make too much of a difference. > >> Semantically, I don't want to call the lock >> acquisition as lock stealing as the queue head is entitled to get the lock >> next. > Fair enough I suppose, pv_wait_head_or_lock() then? > I am fine with that name. >> I can rename pv_queued_spin_trylock_unfair() to >> pv_queued_spin_steal_lock() to emphasize the fact that this is the routine >> where lock stealing happens. > OK. > Cheers, 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/