Re: [GIT PULL] adaptive spinning mutexes

From: Chris Mason
Date: Wed Jan 14 2009 - 13:42:09 EST


On Wed, 2009-01-14 at 19:33 +0100, Ingo Molnar wrote:
> * Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > Full series, including changelogs available at:
> >
> > http://programming.kicks-ass.net/kernel-patches/mutex-adaptive-spin/
> >
> > and should shortly appear in a git tree near Ingo :-)
>
> Linus,
>
> Please pull the adaptive-mutexes-for-linus git tree from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git adaptive-mutexes-for-linus
>

I was going to put this into the btrfs tree, but since you have a branch
just for adaptive mutexes, is it easier to put there?

From: Chris Mason <chris.mason@xxxxxxxxxx>

Btrfs: stop spinning on mutex_trylock and let the adaptive code spin for us

Mutexes now spin internally and the btrfs spin is no longer required for
performance.

Signed-off-by: Chris Mason <chris.mason@xxxxxxxxxx>

diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
index 39bae77..40ba8e8 100644
--- a/fs/btrfs/locking.c
+++ b/fs/btrfs/locking.c
@@ -37,16 +37,6 @@

int btrfs_tree_lock(struct extent_buffer *eb)
{
- int i;
-
- if (mutex_trylock(&eb->mutex))
- return 0;
- for (i = 0; i < 512; i++) {
- cpu_relax();
- if (mutex_trylock(&eb->mutex))
- return 0;
- }
- cpu_relax();
mutex_lock_nested(&eb->mutex, BTRFS_MAX_LEVEL - btrfs_header_level(eb));
return 0;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/