Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp760667imm; Tue, 5 Jun 2018 04:09:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEwTzmFzjZZ9ZALsoAcp+3T4DnwRswSTZzw8AC3Lz3LXBICBB22eeXEzPKs48R8thUrk1w X-Received: by 2002:a17:902:205:: with SMTP id 5-v6mr25380565plc.301.1528196949179; Tue, 05 Jun 2018 04:09:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528196949; cv=none; d=google.com; s=arc-20160816; b=y/877sk4QEdmzZSp71+5SCDjtP8FGuYa9YDzKPyV6KYr58UOMb6eNOQ6cQSoeBWRLp cEwaQZ72k1ceMyghDmy1O5lIfOjNA/6+LjRrCmMZM9CkZt7hLCZkQhMBcCS3xlAshswO fJlZ86QjNKXmZxGSQwSanxUJUxjBeFyVYOvlL4oEyb81VQM9JCWqwdA/FfcpE/g/Sz7u 6whoY2KGR+2ce8YukCLEyyLXwLV0FgWWoLOiA4FBjnTc6EAlcQBZ6s9OMqnJxrZalqsW okOwr96MOa5mvJhE8j3AgHFYAjDpRd14oZk4QK7pDr0zw6P6YM/cACoEoExyzFfkuw62 mVOA== 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=qi9CgMyAP+/5oXqCNjuUj9Agn6Yxese08MMo7BRufsE=; b=GGyWFzUlQgwtfMNSwwW7WAJnFV8tNnN/k9VqAEli8WO3s6MsI65TbFvvU2zDgxElM9 Y6J4B8HG08UTuhB/hjGs55C8cQObuAbZDCCfBV7mvlcSBZtbyReLdoL/1WEXxl/9vT/h qbRp2KkxsUnei/ATd39/mEzMq5ccA54w/8TbzBYpHlJXqzCj//dSdra4+bbB5zwrYZ1t qK1IHvsHNja8ydKtxheMoWc+yxn8fdKSuS70W1JHmYihoR5voDYmfTfzhY7tapenrRay tA7fgPsldIfNyCbhJw79KGLa3cu6Ap2GbcmP6Fau6BDiEGNlFkapcY1JJZVLBQjjJXcp KWmg== 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 p6-v6si24544456pfl.279.2018.06.05.04.08.54; Tue, 05 Jun 2018 04:09:09 -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 S1751747AbeFELIP (ORCPT + 99 others); Tue, 5 Jun 2018 07:08:15 -0400 Received: from foss.arm.com ([217.140.101.70]:54594 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751498AbeFELIO (ORCPT ); Tue, 5 Jun 2018 07:08:14 -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 E3DB61435; Tue, 5 Jun 2018 04:08:13 -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 688B83F557; Tue, 5 Jun 2018 04:08:11 -0700 (PDT) Date: Tue, 5 Jun 2018 12:08:08 +0100 From: Mark Rutland To: Michael Ellerman Cc: Peter Zijlstra , 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 , Palmer Dabbelt , Albert Ou Subject: Re: [PATCHv2 05/16] atomics: prepare for atomic64_fetch_add_unless() Message-ID: <20180605110808.5ms6kbsayj2dbo7z@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> <20180605095357.64zgw3uq3py2pjs4@lakrids.cambridge.arm.com> <87bmcpo65w.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bmcpo65w.fsf@concordia.ellerman.id.au> 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 08:54:03PM +1000, Michael Ellerman wrote: > Mark Rutland writes: > > 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. > > */ > > If we're bike-shedding .. :) > > I think "so long as" is overly wordy and not helpful. It'd be clearer > just as: > > * Atomically increments @v by 1, if @v is non-zero. I agree; done. Mark.