Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2757099imm; Thu, 24 May 2018 15:36:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpAGNhuPtbjw/8AxMF8cf+/PjRSQ8my3rHvLayeBqE6vY88SBYK+kjOK+Lv06MTY0tBDZ7k X-Received: by 2002:a17:902:265:: with SMTP id 92-v6mr9008953plc.368.1527201391585; Thu, 24 May 2018 15:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527201391; cv=none; d=google.com; s=arc-20160816; b=qz1xkuOlcYkKYTbzq/912nsQZ3ptxdOsBTlncWtnMXi9tv9Y1Vl6TiTZqd/y8i+elh o6CqOUyHiqWFczlu2mTg6+MWjh0ybo6CZpCMpYqtadLJsXXY2fdJIesf/ENsIkJ4dZA8 Uolcfentq9qfKUvZ6E4qcpKTggwHbm56dYmr2pasicCJxO4/bdp0VISOvS3+YT0JvsQf LE+GbFodo2heO8uFaGC+MGYzHCkk38Rxy3fsXzWUNF4kMocoIsMmS65TA3pbtIZMtsxF UHydyhGfbN993kFmzc8CdAXsFTIhUkFsutoY6pcieU2KkhpAen3cSVu+Knsj/paV7uDI hNUw== 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:arc-authentication-results; bh=EZ4Jo3kVwSzuKsjoDgaDahiJEyF7/X00LTvvANC+3zI=; b=jbGKx1wbD+2Ub4X2qsjKLQprXrA6lYtA/dgRBLOOq7avTWrwvmfQ4xYDSMk6OqIfrg qkvzThApR5T0KeOutnS+4AfF0LBNGTH6/idXn+h5xr83g9+AroL6c/SHHutZVa+ncpER IjduRQWLjc0biExYA+eh6KluFuu7jUybOmkZfmbxwNtw63dqOvBM5rWJ7RIZwiJJYz1g iGIHnyQmSk8qc2U0G/9WGcOIgg5jz+RBX+o8HCTzsoEe9xfMy+Ofd6m8j4Hr6PqQrdBk 6hf4Afp6F3Fylfv9d6zRx+JeFYEO0zotRK1Iht/7iywJWfHEULZm4DgCyuw0o4vt15j1 ieZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=toPlu7L8; 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 b3-v6si1897448pls.119.2018.05.24.15.36.16; Thu, 24 May 2018 15:36:31 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=toPlu7L8; 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 S964979AbeEXMoR (ORCPT + 99 others); Thu, 24 May 2018 08:44:17 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:34806 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935296AbeEXMoO (ORCPT ); Thu, 24 May 2018 08:44:14 -0400 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=EZ4Jo3kVwSzuKsjoDgaDahiJEyF7/X00LTvvANC+3zI=; b=toPlu7L83upWcXCaXd52kfIXF a4m5utdFTa5FSGW3of/kTBPZqwXbd1i9RKO0HpYEVzPM8IKI0OsUdvpx06S3ThBt7RBxbrYrwvmOW Sbmgv4r/zDWOo0xmF+KbYjGP8V6o71oSZBq8tYNRcI8H+URzbpOz+3aM3J/rTQxwjn3B5vQHr1fmy 9t8pgI8ZG6w42Tp5721P2ikYn7VKhGDAluPis4f58odL2DVn6nLWADe1hPDvcuWqJC8VAVoiYUloR 0diHxU13nOTEmcaG/K9ppjSYbeYuSfauKCkEB1gPDC6crTvzDUs6vdDby+NXgSO2eWTt3uTSyv0V4 m0bQV7V/g==; 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 1fLpbI-0002QS-Ly; Thu, 24 May 2018 12:44:12 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BEF302029F1C5; Thu, 24 May 2018 14:44:10 +0200 (CEST) Date: Thu, 24 May 2018 14:44:10 +0200 From: Peter Zijlstra To: Will Deacon 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: <20180524124410.GF12198@hirez.programming.kicks-ass.net> References: <1527159586-8578-1-git-send-email-will.deacon@arm.com> <1527159586-8578-7-git-send-email-will.deacon@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1527159586-8578-7-git-send-email-will.deacon@arm.com> User-Agent: Mutt/1.9.5 (2018-04-13) 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 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?