Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933028AbcCQJJR (ORCPT ); Thu, 17 Mar 2016 05:09:17 -0400 Received: from mail.osadl.at ([92.243.35.153]:51237 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755827AbcCQJJO (ORCPT ); Thu, 17 Mar 2016 05:09:14 -0400 Date: Thu, 17 Mar 2016 08:05:26 +0000 From: Nicholas Mc Guire To: Peter Zijlstra Cc: Steven Rostedt , Joel Fernandes , Greg Kroah-Hartman , linux-rt-users@vger.kernel.org, Linux Kernel Mailing List , kernelnewbies , Ingo Molnar , Thomas Gleixner Subject: Re: RFC on fixing mutex spinning on owner Message-ID: <20160317080526.GB6679@osadl.at> References: <20160316233530.GA8731@kroah.com> <20160316221751.71816309@grimm.local.home> <20160317073605.GM6344@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160317073605.GM6344@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1359 Lines: 56 On Thu, Mar 17, 2016 at 08:36:05AM +0100, Peter Zijlstra wrote: > On Wed, Mar 16, 2016 at 10:17:51PM -0400, Steven Rostedt wrote: > > Actually, the preempt off section here is not really an issue: > > > > rcu_read_lock(); > > while (owner_running(lock, owner)) { > > if (need_resched()) > > break; > > > > cpu_relax_lowlatency(); > > } > > rcu_read_unlock(); > > > > Although preemption may be disabled, that "need_resched()" check will > > break out of the loop if a higher priority task were to want to run on > > this CPU. > > > > I probably should add a hook there to let the preemptoff tracer know > > that this is not an issue. > > Urgh, there's a lot of such spin loops all over, that's going to be a > pain to annotate all. scanning for that patter with a quite relaxed spatch did not turn up more than a hand full: @resched_spin exists@ position p; @@ ( * while@p (...) { ... if (need_resched() || ...) break; ... \(cpu_relax\|cpu_relax_lowlatency\)(); } | * while@p (!need_resched()) { ... \(cpu_relax\|cpu_relax_lowlatency\)(); } ) @script:python@ p << resched_spin.p; @@ print "%s:%s " % (p[0].file,p[0].line) is this making some wrong assumptions here or is this really so infrequent ? thx! hofrat