From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753901AbcAVNl5 (ORCPT ); Fri, 22 Jan 2016 08:41:57 -0500 Received: from g2t4622.austin.hp.com ([15.73.212.79]:47557 "EHLO g2t4622.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753853AbcAVNlo (ORCPT ); Fri, 22 Jan 2016 08:41:44 -0500 Message-ID: <56A23195.4000802@hpe.com> Date: Fri, 22 Jan 2016 08:41:41 -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: Ding Tianhong , Ingo Molnar , "linux-kernel@vger.kernel.org" , Davidlohr Bueso , Linus Torvalds , "Paul E. McKenney" , Thomas Gleixner , Will Deacon , Jason Low , Tim Chen , Waiman Long Subject: Re: [PATCH RFC] locking/mutexes: don't spin on owner when wait list is not NULL. References: <56A0A4ED.3070308@huawei.com> <56A1638A.7050202@hpe.com> <20160122085422.GO6357@twins.programming.kicks-ass.net> In-Reply-To: <20160122085422.GO6357@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 01/22/2016 03:54 AM, Peter Zijlstra wrote: > On Thu, Jan 21, 2016 at 06:02:34PM -0500, Waiman Long wrote: >> This patch attempts to fix this live-lock condition by enabling the >> a woken task in the wait list to enter optimistic spinning loop itself >> with precedence over the ones in the OSQ. This should prevent the >> live-lock >> condition from happening. > > So I think having the top waiter going back in to contend on the OSQ is > an excellent idea, but I'm not sure the wlh_spinning thing is important. Yes, that is optional. I put it there just to make it is more likely for the waiter spinner to get the lock. Without that, the chance will be 50/50 on average. I can certainly take that out. > The OSQ itself is FIFO fair, and the waiters retain the wait_list > position. So having the top wait_list entry contending on the OSQ > ensures we cannot starve (I think). > > Also, as Davidlohr said, we cannot copy/paste this much code. As I said in the previous mail, I do intend to refactor it before sending out the official patch. Cheers, Longman