From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [GIT PULL] adaptive spinning mutexes Date: Thu, 15 Jan 2009 19:08:44 +0100 Message-ID: <20090115180844.GL22472@elte.hu> References: <1231863710.7141.3.camel@twins> <1231864854.7141.8.camel@twins> <1231867314.7141.16.camel@twins> <1231952436.14825.28.camel@laptop> <20090114183319.GA18630@elte.hu> <20090114184746.GA21334@elte.hu> <20090114192811.GA19691@elte.hu> <20090115174440.GF29283@parisc-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Matthew Wilcox , Peter Zijlstra , "Paul E. McKenney" , Gregory Haskins , Andi Kleen , Chris Mason , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Nick Piggin , Peter Morreale , Sven Dietrich , Dmitry Adamushko , Johannes Weiner To: Linus Torvalds Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:43279 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755077AbZAOSJI (ORCPT ); Thu, 15 Jan 2009 13:09:08 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: * Linus Torvalds wrote: > > Has anyone found a non-synthetic benchmark where this makes a > > significant difference? Aside from btrfs, I mean. > > Yea, if you have some particular filesystem (or other subsystem) that > uses a global mutex, you'll obviously see way more contention. Btrfs may > not be _unique_ in this regard, but it's definitely doing something that > isn't good. > > Btw, it's doing something that ext3 also used to do iirc, until we fixed > it to use spinlocks instead (the block group lock in particular). > > Yeah - just double-checked. Commit c12b9866ea52 in the historical Linux > archive, from 2003. Which made block allocation protected by a per-group > spinlock, rather than lock_super(). btw., i think spin-mutexes have a design advantage here: in a lot of code areas it's quite difficult to use spinlocks - cannot allocate memory, cannot call any code that can sporadically block (but does not _normally_ block), etc. With mutexes those atomicity constraints go away - and the performance profile should now be quite close to that of spinlocks as well. Ingo