Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp786355imj; Thu, 7 Feb 2019 11:49:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IY99557TFDQPLrEO0LR/bC39q3UYszE+WlkJbT1ahUX92lOEhTBGpBMSfu0IxLOFBclN+aV X-Received: by 2002:a17:902:64:: with SMTP id 91mr9364245pla.229.1549568954235; Thu, 07 Feb 2019 11:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549568954; cv=none; d=google.com; s=arc-20160816; b=EqcBp5zo2GDtA0ymRFv2N6m7yK7cPjc4JYdexCZWSGIilgd4RIpnJnzCvm44lrRn7N BB9gyZFVCsIsUaTx12JVpFl1gPEaI/3rtJtpRd40B1YOx4fuET9WPUw4SVGYkKG2XuXN 3lREUT4a23Jb/oabug4SG1XBad16VuUu07nuQT2VYaGcYnpW7ko1U4dDfZWK1bjw99Hc 1Cz7S466ia72Q0kURPcTB4uCUhXj0U97nB1XaNAowk+5/tHHk5QNpKy0sa8AwvnNNMuv QQ2o/irTzAZqlgb0DMAoyxuKnKip4n16+6gYg/sW65mNWz1Hb3P/iNj+Yifv5SaTMDUS LbuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=1CcmVVwzqXHvGyue8+fGzj5x9f2QCCBdzMmFKuWYvvI=; b=L+MeEOWiQ8FxFRTkmi6ZxQK9yfKjp+Fxvy1iTA3C3bdgbOwx/X+qYkFsr2utb9Xspj HN0QLxrdWTosqsVDGAbUB0ZSXX64NKJn6OEGfgFPR2ICQuC1Yz53TvYTCZE426UBuH6J Qd6KHnCgd0Gg4QS20GySKinZnXDmP3dXWsH8D8Ya2ytotZrHLif1NZpmCRUTEuE94EvK QOs0MvRucrrsSjmjzfZe2/n6VbHoVlMigeTQ7MkTw1w1zpKxlPDM6gA6hHxlrhq37opK OHbCOvixOjqg2H08+6gP7LnhfHHd6P0hOhDzoe9S41+yI9OT+hOf7zk5yYSv6HoyvxtV Yuxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=f14eLpKt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c139si10611064pfb.281.2019.02.07.11.48.58; Thu, 07 Feb 2019 11:49:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=f14eLpKt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbfBGTso (ORCPT + 99 others); Thu, 7 Feb 2019 14:48:44 -0500 Received: from merlin.infradead.org ([205.233.59.134]:45814 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727099AbfBGTsn (ORCPT ); Thu, 7 Feb 2019 14:48:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1CcmVVwzqXHvGyue8+fGzj5x9f2QCCBdzMmFKuWYvvI=; b=f14eLpKtzKaxMtx4VihGne5Yv 3uhI+pBxOe/zRqrgJUKcIEm2hz91td1S43Na3Y59E83kGj7N3Yzgkjvn0IJS7aqXnkf4MDwmT4ZI+ WMD3LjZaKNTa3Rn9yYaoGdDB1k91hT/asZAoIAU4uh/Wa/MOYJJPpJ7UT1+NElwtMDe1nTPq8Q1nz QS+dSRwJjJYFfVDxKHR/kxi62mnUxBlgXGFrG/pCvpeO17dMiPrdJ8TAKIzG2SURuhksc7gEJlaNe Bv0bVqtu482N3/gyYF7VsFKBJ2mT7S0bgfMYfznX2oafvgTylrSNqrBQJ8S1QJtrQ8E5xeYMvAjTu T81w7uqYA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1grpew-00075D-3U; Thu, 07 Feb 2019 19:48:30 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DD0EB2029E062; Thu, 7 Feb 2019 20:48:28 +0100 (CET) Date: Thu, 7 Feb 2019 20:48:28 +0100 From: Peter Zijlstra To: Waiman Long Cc: Ingo Molnar , Will Deacon , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-arch@vger.kernel.org, x86@kernel.org, Arnd Bergmann , Borislav Petkov , "H. Peter Anvin" , Davidlohr Bueso , Linus Torvalds , Andrew Morton , Tim Chen Subject: Re: [PATCH-tip 04/22] locking/rwsem: Remove arch specific rwsem files Message-ID: <20190207194828.GC32534@hirez.programming.kicks-ass.net> References: <1549566446-27967-1-git-send-email-longman@redhat.com> <1549566446-27967-5-git-send-email-longman@redhat.com> <20190207193656.GF32511@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190207193656.GF32511@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 07, 2019 at 08:36:56PM +0100, Peter Zijlstra wrote: > On Thu, Feb 07, 2019 at 02:07:08PM -0500, Waiman Long wrote: > > > +static inline int __down_read_trylock(struct rw_semaphore *sem) > > +{ > > + long tmp; > > + > > + while ((tmp = atomic_long_read(&sem->count)) >= 0) { > > + if (tmp == atomic_long_cmpxchg_acquire(&sem->count, tmp, > > + tmp + RWSEM_ACTIVE_READ_BIAS)) { > > + return 1; > > + } > > + } > > Nah, you're supposed to write that like: > > for (;;) { > val = atomic_long_cond_read_relaxed(&sem->count, VAL < 0); > if (atomic_long_try_cmpxchg_acquire(&sem->count, &val, > val + RWSEM_ACTIVE_READ_BIAS)) > break; > } N/m that's not in fact the same... > > + return 0; > > +} > > > Anyway, yuck, you're keeping all that BIAS nonsense :/ I was so hoping > for a rwsem implementation without that impenetrable crap.