From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH -v5][RFC]: mutex: implement adaptive spinning Date: Wed, 7 Jan 2009 15:52:46 -0800 (PST) Message-ID: References: <1231283778.11687.136.camel@twins> <1231329783.11687.287.camel@twins> <1231347442.11687.344.camel@twins> <20090107210923.GV2002@parisc-linux.org> <20090107213924.GP496@one.firstfloor.org> <49652C7C.3000909@novell.com> <20090107223317.GB27629@elte.hu> <4965331E.8090202@novell.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Gregory Haskins , Ingo Molnar , Andi Kleen , Matthew Wilcox , Peter Zijlstra , paulmck@linux.vnet.ibm.com, Chris Mason , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Nick Piggin , Peter Morreale , Sven Dietrich To: Steven Rostedt Return-path: In-Reply-To: List-ID: On Wed, 7 Jan 2009, Steven Rostedt wrote: > > On Wed, 7 Jan 2009, Steven Rostedt wrote: > > > > True. I need to keep looking at the code that is posted. In -rt, we force > > the fast path into the slowpath as soon as another task fails to get the > > lock. Without that, as you pointed out, the code can be racy. > > I mean we force the fast unlock path into the slow path as soon as another > task fails to get the lock. I think the mainline mutex code does that all right too - we keep the counter negative all the time when it has contention. So the original model where the spinning was done only after we'd gotten the spinlock probably was correct. However, it _is_ a lot more expensive than the "optimistic spin" model. Linus