public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: paulmck@linux.vnet.ibm.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Christoph Lameter <cl@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Andi Kleen <andi@firstfloor.org>,
	Nick Piggin <npiggin@kernel.dk>
Subject: Re: [PATCH] atomic: add atomic_inc_not_zero_hint()
Date: Fri, 05 Nov 2010 20:12:51 +0100	[thread overview]
Message-ID: <1288984371.2665.13.camel@edumazet-laptop> (raw)
In-Reply-To: <20101105184034.GG2850@linux.vnet.ibm.com>

Le vendredi 05 novembre 2010 à 11:40 -0700, Paul E. McKenney a écrit :

> OK, so I cannot resist the challenge...  ;-)
> 

I knew that ;)

> Suppose that the atomic_inc_not_zero_hint() is in common code that might
> be invoked from a cleanup path.  On the cleanup path, perhaps within an
> RCU callback, if the reference is zero, we have the only reference and
> thus don't need to increment the reference count.  On the other hand,
> if the reference is non-zero, we want to obtain a reference in order
> to safely attempt to encourage the other reference holder to let go
> more quickly.
> 
> Perhaps a bit of a stretch, but why not just replace the above
> "return 0" with "atomic_inc_not_zero(v)"?  It will usually be
> compiled out, right?

Yes indeed, thanks !




      reply	other threads:[~2010-11-05 19:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05 16:53 [PATCH] atomic: add atomic_inc_not_zero_hint() Eric Dumazet
2010-11-05 17:20 ` Andrew Morton
2010-11-05 18:00   ` Eric Dumazet
2010-11-05 18:08     ` Andrew Morton
2010-11-05 18:20       ` Eric Dumazet
2010-11-05 18:28         ` Andrew Morton
2010-11-05 19:20           ` Eric Dumazet
2010-11-05 19:39             ` Andrew Morton
2010-11-05 19:46               ` Eric Dumazet
2010-11-05 19:51             ` Paul E. McKenney
2010-11-12 19:14               ` Christoph Lameter
2010-11-13 22:26                 ` Paul E. McKenney
2010-11-15 13:57                   ` Christoph Lameter
2010-11-15 14:07                     ` Andi Kleen
2010-11-15 14:16                       ` Christoph Lameter
2010-11-15 14:17                     ` Eric Dumazet
2010-11-15 14:25                       ` Christoph Lameter
2010-11-15 14:39                         ` Andi Kleen
2010-11-15 14:47                         ` Eric Dumazet
2010-11-05 18:40     ` Paul E. McKenney
2010-11-05 19:12       ` Eric Dumazet [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1288984371.2665.13.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=acme@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=cl@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=npiggin@kernel.dk \
    --cc=paulmck@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox