mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Kent Overstreet <koverstreet@google.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] percpu-refcount: Don't use silly cmpxchg()
Date: Mon, 3 Jun 2013 16:09:13 -0700	[thread overview]
Message-ID: <20130603230913.GE29989@mtj.dyndns.org> (raw)
In-Reply-To: <1370300549-2177-1-git-send-email-koverstreet@google.com>

On Mon, Jun 03, 2013 at 04:02:29PM -0700, Kent Overstreet wrote:
> The cmpxcgh() was just to ensure the debug check didn't race, which was
> a bit excessive. The caller is supposed to do the appropriate
> synchronization, which means percpu_ref_kill() can just do a simple
> store.
> 
> Signed-off-by: Kent Overstreet <koverstreet@google.com>

Applied to percpu/for-3.11.

The only concern I have left now is that we now have bitwise-and and
test instead of just test in the hot path (get/put) to test whether
the percpu part is alive.  As x86 has single and-and-test instruction
which doesn't require an output register, this only adds a single
instruction but this may lead to more overhead on other architectures.

The and-and-test was added because RCU free needs to have access to
the percpu pointer after the pointer is killed and can be removed by
adding another field to struct percpu_ref which remembers the pointer
separately from the original percpu pointer, which I think is a better
trade-off given that it makes the hot path lighter and adding another
pointer field to struct percpu_ref isn't really gonna affect anything.
Plus, it'd also make the code simpler.

Anyways, it's not a big concern at this point and we can address it
later.

Thanks a lot, everyone!

-- 
tejun

  reply	other threads:[~2013-06-03 23:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 22:26 [PATCH] Generic percpu refcounting Kent Overstreet
2013-06-03 22:39 ` Tejun Heo
2013-06-03 23:02 ` [PATCH] percpu-refcount: Don't use silly cmpxchg() Kent Overstreet
2013-06-03 23:09   ` Tejun Heo [this message]
2013-06-05  7:35 ` [PATCH] Generic percpu refcounting Rusty Russell
2013-06-05  7:44   ` Tejun Heo

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=20130603230913.GE29989@mtj.dyndns.org \
    --to=tj@kernel.org \
    --cc=koverstreet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®