Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932489AbbHCVaU (ORCPT ); Mon, 3 Aug 2015 17:30:20 -0400 Received: from g2t2353.austin.hp.com ([15.217.128.52]:17511 "EHLO g2t2353.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932144AbbHCVaS (ORCPT ); Mon, 3 Aug 2015 17:30:18 -0400 Message-ID: <55BFDD66.2010302@hp.com> Date: Mon, 03 Aug 2015 17:30:14 -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: Davidlohr Bueso CC: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Scott J Norton , Douglas Hatch Subject: Re: [PATCH v4 2/7] locking/pvqspinlock: Add pending bit support References: <1438395724-25910-1-git-send-email-Waiman.Long@hp.com> <1438395724-25910-3-git-send-email-Waiman.Long@hp.com> <1438627026.17146.14.camel@stgolabs.net> In-Reply-To: <1438627026.17146.14.camel@stgolabs.net> Content-Type: text/plain; charset=UTF-8; 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: 1512 Lines: 43 On 08/03/2015 02:37 PM, Davidlohr Bueso wrote: > On Fri, 2015-07-31 at 22:21 -0400, Waiman Long wrote: >> /* >> + * Try to acquire the lock and wait using the pending bit >> + */ >> +static int pv_pending_lock(struct qspinlock *lock, u32 val) > Sorry but, why did yo not rewrite the function as we had previously > discussed. This is very confusing to read, the one I suggested follows a > much nicer flow and purposely illustrates the intention. You also failed > to address my loop semantics concerns altogether. > > Thanks, > Davidlohr > I am sorry that I might have misinterpret what you wanted. Right now, the latest code have 3 loops in the pending function: 1. Waiting for pending locker to become lock holder 2. A loop to do the trylock or set the pending bit. 3. With the pending bit set, another loop to wait until the lock holder frees the lock. The 2nd loop may be a bit confusing to look at. I will try to add more comment to clarify that. The second loop can return without calling clear_pending() because the pending bit will not be set until it breaks out of the loop. I think it will make the code more complicated if we try to merge the 2nd and 3rd loops. Please let me know what kind of rewriting you have in mind. Thanks, 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/