[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0901061602150.3057@localhost.localdomain>
Date: Tue, 6 Jan 2009 16:06:07 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Matthew Wilcox <matthew@....cx>
cc: Peter Zijlstra <peterz@...radead.org>, paulmck@...ux.vnet.ibm.com,
Gregory Haskins <ghaskins@...ell.com>,
Ingo Molnar <mingo@...e.hu>, Andi Kleen <andi@...stfloor.org>,
Chris Mason <chris.mason@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-btrfs <linux-btrfs@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Nick Piggin <npiggin@...e.de>,
Peter Morreale <pmorreale@...ell.com>,
Sven Dietrich <SDietrich@...ell.com>
Subject: Re: [PATCH][RFC]: mutex: adaptive spin
On Tue, 6 Jan 2009, Matthew Wilcox wrote:
> >
> > This looks ugly. Why doesn't __mutex_lock_common() just set the lock
> > owner? Hate seeing it done in the caller that has to re-compute common
> > (yeah, yeah, it's cheap) and just looks ugly.
>
> Because __mutex_lock_common() is the slow path. The fast path is a
> couple of assembly instructions in asm/mutex.h. If the lock isn't
> contended, it will never call __mutex_lock_common().
No, that's not it.
Look at the callers. They are _all_ the slow path. They looked like this:
might_sleep();
return __mutex_lock_common(lock, TASK_KILLABLE, subclass, _RET_IP_);
Yes, you _also_ need to set the owner in the fast-path, but that's all
entirely different. This is the debug case, which _always_ calls the
slow-path.
So what I'm saying is that the slow-path should just set it. And then yes,
we _also_ need to set it in the fast-path, but at least we don't need to
set it in all the debug versions that just call the slow path!
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists