Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp692451imm; Tue, 5 Jun 2018 02:54:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJj3W17/xg4WYiX1lLQNZPGlc6NIw46VqC87PvtMYKqR8Dg1Uk8w6Ei/nhkwG9ewR3KPtUY X-Received: by 2002:a63:a557:: with SMTP id r23-v6mr20240712pgu.336.1528192489976; Tue, 05 Jun 2018 02:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528192489; cv=none; d=google.com; s=arc-20160816; b=y/l7AQQayZISqrm4qP0PgUIXW7LfTuRb0vhvuon2MI8O9rfIN7CykS/v9D1jb1XKfA ClgPOeoa8KWt+M2yOAqitYtDyaVNZvm6Y3eYToLSwKAI3n2iRRCMaFRBjpVp6+VvlJz5 Avp1rSrRV6j0lo13e+cRyra4Zn5lcFmo6W8EYJGG7RB6P5hlJyzBPDuIxB++eAGo1k5Q f4eYjHZHC41YL6PH9DtoZxbUGxjUcuy6pl9R4WfXAmPhXwSMhD5XA5Od2He/FRHjxvD1 yNqGbgAnvXiLSzVJwIwxEDTp3YLERNTrdx0OhDPRfzYhvVgiF0XtG6NXzq/nkR9Vej8Y rUHw== 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=Lgralff6fCYsPoF3/n/KizdYwM9Q2CbAI2H9pYUEqzA=; b=ixCk7mTDPf1Z3dF6Ua5sRlujX30BDp9+y1u22sRhmbhtrhqOxrM0X8Ug13/tFdcjMs Ujp7kNKf0/7qQ/O/eAaCVQksoN690LPBWN616U2TXHau7gj1VQlsAHhHYLhy4Gi6RzL5 vas2Sr+1S1xewGYnGm5AeUQ5NAp+duS0Dzu7jYQ1HGvAsn4wd6UYyxso7qnzemuYMxYJ nxRuGiEv/ZRJ/EDC07Yjhdfll6nTVtT1kakVrl3f1wxN5TPKob+R6L9QVmQLdgT+8Mi/ E4CYafQnzYMCnHDSHKlmU29Rsn2Xk/qckU0YWg/vp/wfRBAAxwIAQjFPIpulHyFltLkh HOng== 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 f5-v6si37448026pgn.453.2018.06.05.02.54.35; Tue, 05 Jun 2018 02:54:49 -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 S1751805AbeFEJyK (ORCPT + 99 others); Tue, 5 Jun 2018 05:54:10 -0400 Received: from foss.arm.com ([217.140.101.70]:53990 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751755AbeFEJyH (ORCPT ); Tue, 5 Jun 2018 05:54:07 -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 88DC71435; Tue, 5 Jun 2018 02:54:06 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4EDA33F557; Tue, 5 Jun 2018 02:54:03 -0700 (PDT) Date: Tue, 5 Jun 2018 10:53:58 +0100 From: Mark Rutland To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Boqun Feng , Will Deacon , Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Palmer Dabbelt , Albert Ou Subject: Re: [PATCHv2 05/16] atomics: prepare for atomic64_fetch_add_unless() Message-ID: <20180605095357.64zgw3uq3py2pjs4@lakrids.cambridge.arm.com> References: <20180529154346.3168-1-mark.rutland@arm.com> <20180529154346.3168-6-mark.rutland@arm.com> <20180605092637.GF12258@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180605092637.GF12258@hirez.programming.kicks-ass.net> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 05, 2018 at 11:26:37AM +0200, Peter Zijlstra wrote: > On Tue, May 29, 2018 at 04:43:35PM +0100, Mark Rutland wrote: > > /** > > + * atomic64_add_unless - add unless the number is already a given value > > + * @v: pointer of type atomic_t > > + * @a: the amount to add to v... > > + * @u: ...unless v is equal to u. > > + * > > + * Atomically adds @a to @v, so long as @v was not already @u. > > + * Returns non-zero if @v was not @u, and zero otherwise. > > I always get confused by that wording; would something like: "Returns > true if the addition was done" not be more clear? Sounds clearer to me; I just stole the wording from the existing atomic_add_unless(). I guess you'll want similar for the conditional inc/dec ops, e.g. /** * atomic_inc_not_zero - increment unless the number is zero * @v: pointer of type atomic_t * * Atomically increments @v by 1, so long as @v is non-zero. * Returns non-zero if @v was non-zero, and zero otherwise. */ > > + */ > > +#ifdef atomic64_fetch_add_unless > > +static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u) > > Do we want to make that a "bool' return? I think so -- that's what the instrumented wrappers (and x86) do today anyhow, and what I ended up using for the generated headers. I'll spin a prep patch cleaning up the existing fallbacks in , along with the comment fixup above, then rework the additions likewise. Thanks, Mark.