Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936135AbdCXU7H (ORCPT ); Fri, 24 Mar 2017 16:59:07 -0400 Received: from mail-it0-f52.google.com ([209.85.214.52]:36120 "EHLO mail-it0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936107AbdCXU64 (ORCPT ); Fri, 24 Mar 2017 16:58:56 -0400 MIME-Version: 1.0 In-Reply-To: <20170324204615.GB5680@worktop> References: <20170324142140.vpyzl755oj6rb5qv@hirez.programming.kicks-ass.net> <20170324164108.ibcxxqbhvx6ao54r@hirez.programming.kicks-ass.net> <20170324172342.radlrhk2z6mwmdgk@hirez.programming.kicks-ass.net> <20170324204615.GB5680@worktop> From: Linus Torvalds Date: Fri, 24 Mar 2017 13:58:53 -0700 X-Google-Sender-Auth: KgJPpvPzOiLcBIqFxUoooHA_AKg Message-ID: Subject: Re: locking/atomic: Introduce atomic_try_cmpxchg() To: Peter Zijlstra Cc: Andy Lutomirski , Dmitry Vyukov , Andrew Morton , Andy Lutomirski , Borislav Petkov , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Josh Poimboeuf , Paul McKenney , Thomas Gleixner , Ingo Molnar , LKML Content-Type: multipart/mixed; boundary=001a114c98b4f75b57054b8042a2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2364 Lines: 50 --001a114c98b4f75b57054b8042a2 Content-Type: text/plain; charset=UTF-8 On Fri, Mar 24, 2017 at 1:46 PM, Peter Zijlstra wrote: > > I certainly like it better, but so far I'm having trouble reproducing > your results. What compiler version are you on? I have: gcc version 6.3.1 20161221 (Red Hat 6.3.1-1) (GCC) from gcc-6.3.1-1.fc24.x86_64 and I'm attaching the edited form of your test-case, just so that we're on the exact same page. Linus --001a114c98b4f75b57054b8042a2 Content-Type: text/x-csrc; charset=US-ASCII; name="tiny.c" Content-Disposition: attachment; filename="tiny.c" Content-Transfer-Encoding: base64 X-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