Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp776992imj; Thu, 7 Feb 2019 11:39:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IYj2/YvNalBFAFrxATzwZyomMMWH1r01Ir00MaI2u0ob7gI5rZH/jwu+wxgfbYAA4nUkmxM X-Received: by 2002:a62:44d8:: with SMTP id m85mr18125342pfi.164.1549568374604; Thu, 07 Feb 2019 11:39:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549568374; cv=none; d=google.com; s=arc-20160816; b=uI797X5mrRezEEqtyj1pPQF+wiPNPhKNQxNN2t92Bl4S2g3VKNMrmJo77s5S0d4lY9 IA3yVJPm/BQt9OUN+t5N2nIIy7S65YT52PoyAXABjrrhnvXzUeN0LF5C8g23Robhkekg 5pApc3nZnq4c4kYfuFaKwnRM0CKB/3dc9NaoOUA3YZkej5tw+lbe7B7gzGzhGBYXIPQh rn5hAVIuO4FcTBK5txiiBx0gU3n4ufx82niu9DpX5eLNaNXw7yX4pLEsGU7OX4kiv9Y5 bBmP9kUV9W+ZOx5B8WkWIv3Johj6hFbyuugrNuy5NLce0y/rTMK6zXAy5qvHAGw0+AeO xDoQ== 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=XyuH3s5btQ7mHAGeF3ZoeE02Akb0cMxexPWpqxP67uA=; b=NYoVX8YbuAwyeah7GKD3FawqZsWYRFkTGlUwLddPKiEMj6JBMH2W6qCigTO55QiY4L Pzn3w2wGMLNNTnt/FEE0Bx3OEmMUExjckbWUooIALlODGwSI/onE9hpY9WbGSZK1OPZo JTs7GeCF7vHjXSj/p2eo0s3hO+upKoQKg3Wo2pQlITZutpMEvmP5iHaVDwCgZbIA6/eI 9cEMmRAz5UaT+rkBbR1DKg59iW+PnGjGInlqK8lBJ/V2ajuE07ylwiewyADfiH/xko5C rBBzjfWnuAmeGTOKmdnaISzwjY+6tIuE8zk/G5v2orgAlI2DY2Gh+1/NEs1ZmlMGrnVL uefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bP26+sXr; 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 u25si5257530pgm.532.2019.02.07.11.39.18; Thu, 07 Feb 2019 11:39:34 -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=bombadil.20170209 header.b=bP26+sXr; 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 S1727037AbfBGThQ (ORCPT + 99 others); Thu, 7 Feb 2019 14:37:16 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:35378 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726824AbfBGThP (ORCPT ); Thu, 7 Feb 2019 14:37:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=XyuH3s5btQ7mHAGeF3ZoeE02Akb0cMxexPWpqxP67uA=; b=bP26+sXr54fuUiR9IiKuknojR 05eeVLzShuE8V2JQQq+lfq9ZtSMoU0jIpnXpvfH4ZhsSvLea4l2sSH5NKBTpsbQLAV7Al75giSjt4 8D/9lUqRmMfG9pqGPFyQe/+x1Wm5DqeO1ii498wxhKnVW3wXrlqtwMhwxrSd74jTQ7PfXWkiAJd2s WZXsHWFftOJha3iNy6AqDdu4EriyGPQIuAx1ekfM1n367vAWmnMagMW/lyFtWJcMQKZFSwevsBhJA MnCmBTgT3RNgZ/zdgpD5R/Ww9xF1HBKd1/4p5r2Bs4+dBP5QTBcUXQNetp4Lp4dJEaqxfwTLblQ+a XoUnvxP+Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1grpTn-0007db-3V; Thu, 07 Feb 2019 19:36:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8E1222029E062; Thu, 7 Feb 2019 20:36:56 +0100 (CET) Date: Thu, 7 Feb 2019 20:36:56 +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: <20190207193656.GF32511@hirez.programming.kicks-ass.net> References: <1549566446-27967-1-git-send-email-longman@redhat.com> <1549566446-27967-5-git-send-email-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1549566446-27967-5-git-send-email-longman@redhat.com> 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 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; } > + return 0; > +} Anyway, yuck, you're keeping all that BIAS nonsense :/ I was so hoping for a rwsem implementation without that impenetrable crap.