From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754256AbcGUU6Y (ORCPT ); Thu, 21 Jul 2016 16:58:24 -0400 Received: from g1t6220.austin.hp.com ([15.73.96.84]:51082 "EHLO g1t6220.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753986AbcGUU6X (ORCPT ); Thu, 21 Jul 2016 16:58:23 -0400 X-Greylist: delayed 164778 seconds by postgrey-1.27 at vger.kernel.org; Thu, 21 Jul 2016 16:58:23 EDT Message-ID: <1469134658.2344.12.camel@j-VirtualBox> Subject: Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled From: Jason Low To: imre.deak@intel.com Cc: jason.low2@hpe.com, Peter Zijlstra , linux-kernel@vger.kernel.org, Ingo Molnar , Chris Wilson , Daniel Vetter , Waiman Long , Davidlohr Bueso Date: Thu, 21 Jul 2016 13:57:38 -0700 In-Reply-To: <1469021399.19093.14.camel@intel.com> References: <1468858607-20481-1-git-send-email-imre.deak@intel.com> <20160718171537.GC6862@twins.programming.kicks-ass.net> <1468864069.2367.21.camel@j-VirtualBox> <1468947205.31332.40.camel@intel.com> <1468969470.10247.15.camel@j-VirtualBox> <1468989556.10247.22.camel@j-VirtualBox> <1469021399.19093.14.camel@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-07-20 at 16:29 +0300, Imre Deak wrote: > On ti, 2016-07-19 at 21:39 -0700, Jason Low wrote: > > On Tue, 2016-07-19 at 16:04 -0700, Jason Low wrote: > > > Hi Imre, > > > > > > Here is a patch which prevents a thread from spending too much "time" > > > waiting for a mutex in the !CONFIG_MUTEX_SPIN_ON_OWNER case. > > > > > > Would you like to try this out and see if this addresses the mutex > > > starvation issue you are seeing in your workload when optimistic > > > spinning is disabled? > > > > Although it looks like it didn't take care of the 'lock stealing' case > > in the slowpath. Here is the updated fixed version: > > This also got rid of the problem, I only needed to change the ww > functions accordingly. Also, imo mutex_trylock() needs the same > handling Good point. I supposed mutex_trylock() may not be causing starvation issues, but I agree that it makes sense if mutex_trylock() fails too if threads are supposed to yield to a waiter. I'll make the update. Thanks, Jason