[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0901071355350.3057@localhost.localdomain>
Date: Wed, 7 Jan 2009 13:58:45 -0800 (PST)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
cc: Steven Rostedt <rostedt@...dmis.org>, paulmck@...ux.vnet.ibm.com,
Gregory Haskins <ghaskins@...ell.com>,
Ingo Molnar <mingo@...e.hu>, Matthew Wilcox <matthew@....cx>,
Andi Kleen <andi@...stfloor.org>,
Chris Mason <chris.mason@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-btrfs <linux-btrfs@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Nick Piggin <npiggin@...e.de>,
Peter Morreale <pmorreale@...ell.com>,
Sven Dietrich <SDietrich@...ell.com>
Subject: Re: [PATCH -v5][RFC]: mutex: implement adaptive spinning
On Wed, 7 Jan 2009, Peter Zijlstra wrote:
>
> Do we really have to re-do all that code every loop?
No, you're right, we can just look up the cpu once. Which makes Andrew's
argument that "probe_kernel_address()" isn't in any hot path even more
true.
> Also, it would still need to do the funny:
>
> l_owner = ACCESS_ONCE(lock->owner)
> if (l_owner && l_owner != thread)
> break;
Why? That would fall out of the
if (lock->owner != thread)
break;
part. We don't actually care that it only happens once: this all has
_known_ races, and the "cpu_relax()" is a barrier.
And notice how the _caller_ handles the "owner == NULL" case by not even
calling this, and looping over just the state in the lock itself. That was
in the earlier emails. So this approach is actually pretty different from
the case that depended on the whole spinlock thing.
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