Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932360AbcC2Qm7 (ORCPT ); Tue, 29 Mar 2016 12:42:59 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:54268 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932281AbcC2Qm6 (ORCPT ); Tue, 29 Mar 2016 12:42:58 -0400 Date: Tue, 29 Mar 2016 18:42:33 +0200 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Linus Torvalds , Ding Tianhong , Jason Low , Davidlohr Bueso , "Paul E. McKenney" , Thomas Gleixner , Will Deacon , Tim Chen Subject: Re: [PATCH v3 2/3] locking/mutex: Enable optimistic spinning of woken task in wait queue Message-ID: <20160329164233.GB11035@twins.programming.kicks-ass.net> References: <1458668804-10138-1-git-send-email-Waiman.Long@hpe.com> <1458668804-10138-3-git-send-email-Waiman.Long@hpe.com> <20160329153935.GL3408@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160329153935.GL3408@twins.programming.kicks-ass.net> 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 Content-Length: 1003 Lines: 20 On Tue, Mar 29, 2016 at 05:39:35PM +0200, Peter Zijlstra wrote: > On Tue, Mar 22, 2016 at 01:46:43PM -0400, Waiman Long wrote: > > Ding Tianhong reported a live-lock situation where a constant stream > > of incoming optimistic spinners blocked a task in the wait list from > > getting the mutex. > > > > This patch attempts to fix this live-lock condition by enabling the > > woken task in the wait queue to enter into an optimistic spinning > > loop itself in parallel with the regular spinners in the OSQ. This > > should prevent the live-lock condition from happening. > > I would very much like a few words on how fairness is preserved. > > Because while the waiter remains on the wait_list while it spins, and > therefore unlock()s will only wake it, and we'll only contend with the > one waiter, the fact that we have two spinners is not fair or starvation > proof at all. Alternatively, we can say this is good enough until proven deficient, but then we should still very much document this.