[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0904090831000.4583@localhost.localdomain>
Date: Thu, 9 Apr 2009 08:35:22 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andi Kleen <andi@...stfloor.org>
cc: Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Jeff Mahoney <jeffm@...e.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
ReiserFS Development List <reiserfs-devel@...r.kernel.org>,
Bron Gondwana <brong@...tmail.fm>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] reiserfs: kill-the-BKL
On Thu, 9 Apr 2009, Andi Kleen wrote:
>
> You have to be very careful with this. Mutexes can be slower than
> spinlocks (and the new BKL is a spinlock) in some situations, they
> typically schedule much more etc., which can be costly.
Actually, with the new adaptive spinning, that basically shouldn't be true
any more. Or rather, you should need some really bad/unlucky situation for
it to scheduler more than necessary, and if the locker _acts_ like a
spinlock (ie it doesn't block while holding the lock), performance should
approach a spinlock.
That said, there are definitely reasons why a mutex can be slower than the
BKL, and the whole "BKL gets implicitly dropped at sleep time" is very
high on that list of reasons. The sleeping patterns can be _very_
different with a mutex than with a BKL.
> Better would be to use spinlocks if possible. I guess you just would
> need to find all sleep points and wrap them with lock dropping?
I do agree that a filesystem should try to avoid sleeping locks if at all
possible, especially on the paths that the VM uses for writeback. But on
the other hand, I think the issue with reiserfs is just the bad latencies
that the BKL can cause, and then it doesn't matter.
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