From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967685AbdCXUqm (ORCPT ); Fri, 24 Mar 2017 16:46:42 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:34891 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966709AbdCXUq1 (ORCPT ); Fri, 24 Mar 2017 16:46:27 -0400 Date: Fri, 24 Mar 2017 21:46:15 +0100 From: Peter Zijlstra To: Linus Torvalds 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 Subject: Re: locking/atomic: Introduce atomic_try_cmpxchg() Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 24, 2017 at 12:08:32PM -0700, Linus Torvalds wrote: > On Fri, Mar 24, 2017 at 10:23 AM, Peter Zijlstra wrote: > > > > I tried a few variants, but nothing really made it better. > > So I really hate how your thing has two return values, and fakes the > second one using the pointer value. Inspired by C11 I'm afraid.. > So how about we change the interface entirely, with the goal being > both type safety and good code generation? I certainly like it better, but so far I'm having trouble reproducing your results. What compiler version are you on?