Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2757930imm; Thu, 24 May 2018 15:37:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr1uTzyYl9ldG1Q+JOU45L95ca377KttmnJby8d3+OM/r412QYBBwTRevEf98+dDIxXqtu1 X-Received: by 2002:a62:ea1a:: with SMTP id t26-v6mr9172330pfh.117.1527201452547; Thu, 24 May 2018 15:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527201452; cv=none; d=google.com; s=arc-20160816; b=sfCD2ukXAQaG2G4D+NRT32oQOQOrGAyV4uvm1pSYKMhMDr8gkgpI5E7vuPMeypaYo0 6o5Dy2nb0IpvQrQY+JT5Rpfyz7zNpuL4nnqIBhOYn9P5dBGDPIthh5XainHXiXtrEZFM hV8tj8/aDU9Fcdb+u+dh5+KIIvLdIF35vncxDiYm1LUUFQBYuwqBnDKlk1ncTky3Ns9G +l7bSwHbverkoQ2YdaCNhr8bXG5/cEVB/+0oe47P7zS3i9VkSELNHMgd9bvzUMUkHtSq yulnDpkxRTK9eTwuTH561e7EB+7ovfmK2TQnNzib4QGKz2pgDbPZTfquitntSWnf1Mjt //9g== 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:arc-authentication-results; bh=UBJ7+IpJwQ0hgKsI0iddZMM4DcAccxSnkOAyiVxNhfg=; b=zm3N38+RGQJb2fqWmitNZuGyOBhpaUBOWdHpeayEmt2P25RBIehxVPqdbeaY/ljvY1 1ly5pCU5lCWjK6hA0Id8mS/Qb8IphQfW37GL5I/H2MmY8bRMMRt7g4sq5fL69uvXmYHE YPmoc0aePy47nXUvBSlp2eBsY3Z8cuyEBKNV2DwyaeER3NWETR6e7HnWNu38qENAFSs5 A6uiqnzUMomoex1ynWNHpt/nnco0m2BcJWxws23R9kZ3xBUjokQskYlnwCYqheYIWjch aIarOMf/GsY1TLhBmzqZ42IiW4upLIT/kzlCTAmrqZK2ENYblphnoCmwZoTCpUaGtYmZ 0eVw== ARC-Authentication-Results: i=1; mx.google.com; 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 e63-v6si22024205pfd.261.2018.05.24.15.37.17; Thu, 24 May 2018 15:37:32 -0700 (PDT) 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; 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 S965180AbeEXMrN (ORCPT + 99 others); Thu, 24 May 2018 08:47:13 -0400 Received: from foss.arm.com ([217.140.101.70]:43900 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964926AbeEXMrM (ORCPT ); Thu, 24 May 2018 08:47:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 71FA91596; Thu, 24 May 2018 05:47:12 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 416403F25D; Thu, 24 May 2018 05:47:12 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 3C9EE1AE3701; Thu, 24 May 2018 13:47:39 +0100 (BST) Date: Thu, 24 May 2018 13:47:39 +0100 From: Will Deacon To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, linux-arm-kernel@lists.infradead.org, yamada.masahiro@socionext.com Subject: Re: [PATCH 6/9] asm-generic/bitops/atomic.h: Rewrite using atomic_fetch_* Message-ID: <20180524124734.GE8689@arm.com> References: <1527159586-8578-1-git-send-email-will.deacon@arm.com> <1527159586-8578-7-git-send-email-will.deacon@arm.com> <20180524124410.GF12198@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180524124410.GF12198@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 24, 2018 at 02:44:10PM +0200, Peter Zijlstra wrote: > On Thu, May 24, 2018 at 11:59:43AM +0100, Will Deacon wrote: > > +static inline void set_bit(unsigned int nr, volatile unsigned long *p) > > { > > + p += BIT_WORD(nr); > > + atomic_long_fetch_or_relaxed(BIT_MASK(nr), (atomic_long_t *)p); > > } > > > > +static inline void clear_bit(unsigned int nr, volatile unsigned long *p) > > { > > + p += BIT_WORD(nr); > > + atomic_long_fetch_andnot_relaxed(BIT_MASK(nr), (atomic_long_t *)p); > > } > > > > +static inline void change_bit(unsigned int nr, volatile unsigned long *p) > > { > > + p += BIT_WORD(nr); > > + atomic_long_fetch_xor_relaxed(BIT_MASK(nr), (atomic_long_t *)p); > > } > > Why use the fetch variants here? I noticed the same thing just now; I'll drop that and just use the non-value-returning variants. It's shame that I can't do the same for the lock.h unlock code, but we don't have non-returning release variants. Will