Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757142AbZANC77 (ORCPT ); Tue, 13 Jan 2009 21:59:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752596AbZANC7r (ORCPT ); Tue, 13 Jan 2009 21:59:47 -0500 Received: from acsinet12.oracle.com ([141.146.126.234]:27668 "EHLO acsinet12.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752430AbZANC7q (ORCPT ); Tue, 13 Jan 2009 21:59:46 -0500 Subject: Re: [PATCH -v9][RFC] mutex: implement adaptive spinning From: Chris Mason To: Peter Zijlstra Cc: Linus Torvalds , Ingo Molnar , "Paul E. McKenney" , Gregory Haskins , Matthew Wilcox , Andi Kleen , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , linux-btrfs , Thomas Gleixner , Nick Piggin , Peter Morreale , Sven Dietrich , Dmitry Adamushko In-Reply-To: <1231867314.7141.16.camel@twins> References: <1231774622.4371.96.camel@laptop> <1231859742.442.128.camel@twins> <1231863710.7141.3.camel@twins> <1231864854.7141.8.camel@twins> <1231867314.7141.16.camel@twins> Content-Type: text/plain Date: Tue, 13 Jan 2009 21:58:19 -0500 Message-Id: <1231901899.1709.18.camel@think.oraclecorp.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 Content-Transfer-Encoding: 7bit X-Source-IP: acsmt703.oracle.com [141.146.40.81] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.496D54D3.0190:SCFSTAT928724,ss=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1674 Lines: 52 On Tue, 2009-01-13 at 18:21 +0100, Peter Zijlstra wrote: > On Tue, 2009-01-13 at 08:49 -0800, Linus Torvalds wrote: > > > > So do a v10, and ask people to test. > > --- > Subject: mutex: implement adaptive spinning > From: Peter Zijlstra > Date: Mon Jan 12 14:01:47 CET 2009 > > Change mutex contention behaviour such that it will sometimes busy wait on > acquisition - moving its behaviour closer to that of spinlocks. > I've spent a bunch of time on this one, and noticed earlier today that I still had bits of CONFIG_FTRACE compiling. I wasn't actually tracing anything, but it seems to have had a big performance hit. The bad news is the simple spin got much much faster, dbench 50 coming in at 1282MB/s instead of 580MB/s. (other benchmarks give similar results) v10 is better that not spinning, but its in the 5-10% range. So, I've been trying to find ways to close the gap, just to understand exactly where it is different. If I take out: /* * If there are pending waiters, join them. */ if (!list_empty(&lock->wait_list)) break; v10 pops dbench 50 up to 1800MB/s. The other tests soundly beat my spinning and aren't less fair. But clearly this isn't a good solution. I tried a few variations, like only checking the wait list once before looping, which helps some. Are there other suggestions on better tuning options? (I retested v7 and see similar results) -chris -- 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/