From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755234AbcGVS3y (ORCPT ); Fri, 22 Jul 2016 14:29:54 -0400 Received: from mga11.intel.com ([192.55.52.93]:52792 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbcGVS3x (ORCPT ); Fri, 22 Jul 2016 14:29:53 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,405,1464678000"; d="scan'208";a="1022157546" Message-ID: <1469212184.9353.15.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 , Waiman Long Cc: Jason Low , Peter Zijlstra , linux-kernel@vger.kernel.org, Ingo Molnar , Chris Wilson , Daniel Vetter Date: Fri, 22 Jul 2016 21:29:44 +0300 In-Reply-To: <20160722180309.GB1881@linux-80c1.suse> 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> <1469134658.2344.12.camel@j-VirtualBox> <57925E25.8010506@hpe.com> <20160722180309.GB1881@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 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. --Imre