Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935055AbZDIPlb (ORCPT ); Thu, 9 Apr 2009 11:41:31 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755422AbZDIPlS (ORCPT ); Thu, 9 Apr 2009 11:41:18 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:60010 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329AbZDIPlR (ORCPT ); Thu, 9 Apr 2009 11:41:17 -0400 Date: Thu, 9 Apr 2009 08:35:22 -0700 (PDT) From: Linus Torvalds X-X-Sender: torvalds@localhost.localdomain To: Andi Kleen cc: Frederic Weisbecker , LKML , Jeff Mahoney , Peter Zijlstra , ReiserFS Development List , Bron Gondwana , Andrew Morton , Ingo Molnar , Alexander Viro Subject: Re: [PATCH] reiserfs: kill-the-BKL In-Reply-To: <87tz4x97uq.fsf@basil.nowhere.org> Message-ID: References: <1239070789-13354-1-git-send-email-fweisbec@gmail.com> <87tz4x97uq.fsf@basil.nowhere.org> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1482 Lines: 33 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/