Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbZAIQoz (ORCPT ); Fri, 9 Jan 2009 11:44:55 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752453AbZAIQoo (ORCPT ); Fri, 9 Jan 2009 11:44:44 -0500 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.125]:35421 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752367AbZAIQon (ORCPT ); Fri, 9 Jan 2009 11:44:43 -0500 Date: Fri, 9 Jan 2009 11:44:40 -0500 (EST) From: Steven Rostedt X-X-Sender: rostedt@gandalf.stny.rr.com To: Linus Torvalds cc: Peter Zijlstra , Chris Mason , Ingo Molnar , paulmck@linux.vnet.ibm.com, Gregory Haskins , Matthew Wilcox , Andi Kleen , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Nick Piggin , Peter Morreale , Sven Dietrich Subject: Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning In-Reply-To: Message-ID: References: <1231441350.14304.48.camel@think.oraclecorp.com> <1231498062.11687.608.camel@twins> <1231513614.442.11.camel@twins> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1460 Lines: 40 On Fri, 9 Jan 2009, Linus Torvalds wrote: > > > On Fri, 9 Jan 2009, Steven Rostedt wrote: > > > > I was going to say a while ago... > > In PREEMPT=y the need_resched() is not needed at all. If you have > > preemption enabled, you will get preempted in that loop. No need for the > > need_resched() in the outer loop. Although I'm not sure how it would even > > hit the "need_resched". If it was set, then it is most likely going to be > > cleared when coming back from being preempted. > > No, no, you miss the point entirely. No I did not miss your point. I was commenting on the current code ;-) > So quite frankly, if you have CONFIG_PREEMPT, then the spinning really is > the wrong thing to do, or the whole mutex slow-path thing should be done > with preemption disabled so that we only schedule where we _should_ be > scheduling. I agree here. I was going to recommend to add a preempt_disable in the spinner. And keep the need_resched test. Then we should not allow preemption until we get all the way to the point of the schedule in the contention case, or when we get the lock. When we get to the schedule() it then needs to be a: preempt_enable_no_resched(); schedule(); -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/