Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756344Ab3H3Pes (ORCPT ); Fri, 30 Aug 2013 11:34:48 -0400 Received: from mail-vb0-f44.google.com ([209.85.212.44]:50579 "EHLO mail-vb0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755121Ab3H3Per (ORCPT ); Fri, 30 Aug 2013 11:34:47 -0400 MIME-Version: 1.0 In-Reply-To: References: <1375758759-29629-1-git-send-email-Waiman.Long@hp.com> <1375758759-29629-2-git-send-email-Waiman.Long@hp.com> <1377751465.4028.20.camel@pasglop> <20130829070012.GC27322@gmail.com> <52200DAE.2020303@hp.com> Date: Fri, 30 Aug 2013 08:34:46 -0700 X-Google-Sender-Auth: vDaXpXhKL9JR0uyhcSKE6bmaUNQ Message-ID: Subject: Re: [PATCH v7 1/4] spinlock: A new lockref structure for lockless update of refcount From: Linus Torvalds To: Sedat Dilek Cc: Waiman Long , Ingo Molnar , Benjamin Herrenschmidt , Alexander Viro , Jeff Layton , Miklos Szeredi , Ingo Molnar , Thomas Gleixner , linux-fsdevel , Linux Kernel Mailing List , Peter Zijlstra , Steven Rostedt , Andi Kleen , "Chandramouleeswaran, Aswin" , "Norton, Scott J" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1438 Lines: 35 On Fri, Aug 30, 2013 at 2:27 AM, Sedat Dilek wrote: > > Here on Ubuntu/precise v12.04.3 AMD64 I get these numbers for total loops: > > lockref: w/o patch | w/ patch > ====================== > Run #1: 2.688.094 | 2.643.004 > Run #2: 2.678.884 | 2.652.787 > Run #3: 2.686.450 | 2.650.142 > Run #4: 2.688.435 | 2.648.409 > Run #5: 2.693.770 | 2.651.514 Yes, so this is pretty much expected. If you don't have a very high core count (you don't mention your system, but that's pretty - I get ~65 million repetitions in 10 seconds on my i5-670), the cmpxchg will not help - because you don't actually see the bad "wait on spinlock" behavior in the first place. And a "cmpxchg" is slightly slower than the very optimized spinlocks, and has that annoying "read original value" first issue too. So the patch can make things a bit slower, although it will depends on the microarchitecture (and as mentioned elsewhere, there are other things that can make a bigger difference boot-to-boot - dentry allocation details etc can have "sticky" performance impact). So we may take a small hit in order to then *not* have horrible scalability at the high end. 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/