From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932432AbcFJR7O (ORCPT ); Fri, 10 Jun 2016 13:59:14 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43014 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932303AbcFJR7J (ORCPT ); Fri, 10 Jun 2016 13:59:09 -0400 X-IBM-Helo: d01dlp03.pok.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-alpha@vger.kernel.org;linux-arch@vger.kernel.org;linux-ia64@vger.kernel.org;linux-kernel@vger.kernel.org;linux-s390@vger.kernel.org;linux-sh@vger.kernel.org;sparclinux@vger.kernel.org Date: Fri, 10 Jun 2016 09:39:41 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: David Howells , Ingo Molnar , Michal Hocko , LKML , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , "David S. Miller" , Tony Luck , Andrew Morton , Chris Zankel , Max Filippov , x86@kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, Michal Hocko , Linus Torvalds , Jason Low Subject: Re: [RFC 10/12] x86, rwsem: simplify __down_write Reply-To: paulmck@linux.vnet.ibm.com References: <20160603223417.GB3892@twins.programming.kicks-ass.net> <1454444369-2146-1-git-send-email-mhocko@kernel.org> <1454444369-2146-11-git-send-email-mhocko@kernel.org> <20160203081016.GD32652@gmail.com> <20160603161339.GC3693@twins.programming.kicks-ass.net> <29355.1465483258@warthog.procyon.org.uk> <20160609173640.GX30154@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160609173640.GX30154@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16061017-0044-0000-0000-0000005C87A1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16061017-0045-0000-0000-0000047186EE Message-Id: <20160610163941.GC3868@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-10_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606100200 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 09, 2016 at 07:36:40PM +0200, Peter Zijlstra wrote: > On Thu, Jun 09, 2016 at 03:40:58PM +0100, David Howells wrote: > > Peter Zijlstra wrote: > > > > > Blergh; so looking at more asm there's still a few tricks we cannot do. > > > So while overall size is down, some paths do end up more expensive. (It > > > typically boils down to creative use of condition flags, which is very > > > hard in C) > > > > It can be done using ISO __atomic_fetch_add() and suchlike. > > (ISO-C11, ISO as such is a bad abbreviation I think) > > Maybe, but we're almost there with __GCC_ASM_FLAG_OUTPUTS__. > > atomic_long_add_negative() can be made to do inc;j(n)s for __down_read. > > the try_cmpxchg family you wanted to add independent from the ISO-C11 > bits can do the cmpxchg-j(n)z for __down_{read,write}_trylock. > > That only leaves us wanting an atomic_long_fetch_add_negative() for > __up_{read,write}(). > > Although I suppose, for this to be of use for our weakly ordered > friends, we need _relaxed versions of all that (so that _acquire and > _release variants are generated). Historically, the compilers have won this sort of contest over the long term. That said, there is nothing quite like raising the bar for them to help them generate decent code. So, David and Peter, I am behind both of you 100%. ;-) Thanx, Paul