From: Peter Zijlstra Subject: Re: [PATCH v5 3/8] qspinlock, x86: Add x86 specific optimization for 2 contending tasks Date: Fri, 28 Feb 2014 18:37:12 +0100 Message-ID: <20140228173712.GZ6835@laptop.programming.kicks-ass.net> References: <1393427668-60228-1-git-send-email-Waiman.Long@hp.com> <1393427668-60228-4-git-send-email-Waiman.Long@hp.com> <20140226162057.GW6835@laptop.programming.kicks-ass.net> <530FA32B.8010202@hp.com> <20140228092945.GG27965@twins.programming.kicks-ass.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: virtualization-bounces@lists.linux-foundation.org Errors-To: virtualization-bounces@lists.linux-foundation.org To: Linus Torvalds Cc: Jeremy Fitzhardinge , Raghavendra K T , Aswin Chandramouleeswaran , Andi Kleen , Peter Anvin , Michel Lespinasse , Alok Kataria , linux-arch@vger.kernel.org, the arch/x86 maintainers , Ingo Molnar , Daniel J Blueman , xen-devel@lists.xenproject.org, Paul McKenney , Alexander Fyodorov , Rik van Riel , Arnd Bergmann , Konrad Rzeszutek Wilk , Scott J Norton , Steven Rostedt , Chris Wright , George Spelvin , Boris Ostrovsky , virtualization List-Id: linux-arch.vger.kernel.org On Fri, Feb 28, 2014 at 08:25:24AM -0800, Linus Torvalds wrote: > On Feb 28, 2014 1:30 AM, "Peter Zijlstra" wrote: > > > > At low contention the cmpxchg won't have to be retried (much) so using > > it won't be a problem and you get to have arbitrary atomic ops. > > Peter, the difference between an atomic op and *no* atomic op is huge. I know, I'm just asking what the difference is between the xchg() - and atomic op, and an cmpxchg(), also an atomic op. The xchg() makes the entire thing somewhat difficult. Needing to fixup all kinds of states if we guessed wrong about what was in the variables. > And Waiman posted numbers for the optimization. Why do you argue with > handwaving and against numbers? I've asked for his benchmark..