From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753649AbcGVTxe (ORCPT ); Fri, 22 Jul 2016 15:53:34 -0400 Received: from mga04.intel.com ([192.55.52.120]:51149 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751124AbcGVTxc (ORCPT ); Fri, 22 Jul 2016 15:53:32 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,405,1464678000"; d="scan'208";a="1022191632" Message-ID: <1469217193.9353.21.camel@intel.com> Subject: Re: [RFC] Avoid mutex starvation when optimistic spinning is disabled From: Imre Deak Reply-To: imre.deak@intel.com To: Davidlohr Bueso Cc: Waiman Long , Jason Low , Peter Zijlstra , linux-kernel@vger.kernel.org, Ingo Molnar , Chris Wilson , Daniel Vetter Date: Fri, 22 Jul 2016 22:53:13 +0300 In-Reply-To: <20160722192606.GC1881@linux-80c1.suse> References: <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> <1469134658.2344.12.camel@j-VirtualBox> <57925E25.8010506@hpe.com> <20160722180309.GB1881@linux-80c1.suse> <1469212184.9353.15.camel@intel.com> <20160722192606.GC1881@linux-80c1.suse> Organization: Intel Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2016-07-22 at 12:26 -0700, Davidlohr Bueso wrote: > On Fri, 22 Jul 2016, Imre Deak wrote: > > > On Fri, 2016-07-22 at 11:03 -0700, Davidlohr Bueso wrote: > > > On Fri, 22 Jul 2016, Waiman Long wrote: > > > > > > > I think making mutex_trylock() fail maybe a bit too far. Do we > > > > really > > > > have any real workload that cause starvation problem  because > > > > of > > > > that. > > > > Code that does mutex_trylock() in a loop can certainly cause > > > > lock > > > > starvation, but it is not how mutex_trylock() is supposed to be > > > > used. > > > > We can't build in safeguard for all the possible abuses of the > > > > mutex > > > > APIs. > > > > > > True, and that's actually why I think that 'fixing' the > > > !SPIN_ON_OWNER case > > > is a bit too far in the first place: most of the archs that will > > > care > > > about > > > this already have ARCH_SUPPORTS_ATOMIC_RMW. The extra code for > > > dealing with > > > this is not worth it imo. > > > > SPIN_ON_OWNER is also disabled in case of DEBUG_MUTEXES, which is > > the > > config where I wanted to avoid starvation in the first place. > > Well yes, but know of course that that option is even less common > than > archs with non atomic Rmw. The point is that it's broken atm. --Imre