From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816AbcAVIyp (ORCPT ); Fri, 22 Jan 2016 03:54:45 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:33049 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbcAVIyl (ORCPT ); Fri, 22 Jan 2016 03:54:41 -0500 Date: Fri, 22 Jan 2016 09:54:22 +0100 From: Peter Zijlstra To: Waiman Long 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. Message-ID: <20160122085422.GO6357@twins.programming.kicks-ass.net> References: <56A0A4ED.3070308@huawei.com> <56A1638A.7050202@hpe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56A1638A.7050202@hpe.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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.