From: Oleg Nesterov <oleg@redhat.com>
To: Kent Overstreet <koverstreet@google.com>
Cc: tj@kernel.org, srivatsa.bhat@linux.vnet.ibm.com,
rusty@rustcorp.com.au, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] generic dynamic per cpu refcounting
Date: Mon, 28 Jan 2013 19:50:39 +0100 [thread overview]
Message-ID: <20130128185039.GA19235@redhat.com> (raw)
In-Reply-To: <20130128181001.GZ26407@google.com>
On 01/28, Kent Overstreet wrote:
>
> On Fri, Jan 25, 2013 at 07:29:24PM +0100, Oleg Nesterov wrote:
> > On 01/25, Oleg Nesterov wrote:
> > >
> > > > +void __percpu_ref_get(struct percpu_ref *ref, bool alloc)
> > > > +{
> > > > + unsigned long pcpu_count;
> > > > + uint64_t v;
> > > > +
> > > > + pcpu_count = ACCESS_ONCE(ref->pcpu_count);
> > > > +
> > > > + if (REF_STATUS(pcpu_count) == PCPU_REF_PTR) {
> > > > + /* for rcu - we're not using rcu_dereference() */
> > > > + smp_read_barrier_depends();
> > > > + __this_cpu_inc(*((unsigned __percpu *) pcpu_count));
> > >
> > > The comment looks confusing a bit... smp_read_barrier_depends() is not
> > > for rcu, we obviously need it to access (unsigned __percpu *) pcpu_count.
> > > But yes, since we didn't use rcu_dereference() we have to add it by hand.
> >
> > Hmm. Otoh, arch/alpha uses asm-generic/percpu.h so in theory we need
> > smp_read_barrier_depends() after __this_cpu_generic_to_op() calculates the
> > "real" pointer, __this_cpu_ptr() ?
> >
> > Just curious...
>
> Don't think I follow, but I don't see how... that barriers just needs to
> be between the ACCESS_ONCE and touching the memory pointed to, the fact
> that there's a calculation in there to get the real pointer is
> irrelevant...
Yes, I was wrong. I forgot that pcp is already the pointer even in
_generic_ case, we only add the offset.
Thanks for correcting me.
Oleg.
next prev parent reply other threads:[~2013-01-28 18:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130124232024.GA584@google.com>
2013-01-25 18:09 ` [PATCH] generic dynamic per cpu refcounting Oleg Nesterov
2013-01-25 18:29 ` Oleg Nesterov
2013-01-28 18:10 ` Kent Overstreet
2013-01-28 18:50 ` Oleg Nesterov [this message]
2013-01-25 19:11 ` Oleg Nesterov
2013-01-28 18:15 ` Kent Overstreet
2013-01-28 18:27 ` Tejun Heo
2013-01-28 18:49 ` Kent Overstreet
2013-01-28 18:55 ` Tejun Heo
2013-01-28 20:22 ` Kent Overstreet
2013-01-28 20:27 ` Tejun Heo
2013-01-28 20:55 ` Kent Overstreet
2013-01-28 21:18 ` Tejun Heo
2013-01-28 21:24 ` Kent Overstreet
2013-01-28 21:28 ` Tejun Heo
2013-01-28 21:36 ` Tejun Heo
2013-01-28 21:48 ` Kent Overstreet
2013-01-28 21:45 ` Kent Overstreet
2013-01-28 21:50 ` Tejun Heo
2013-01-29 16:39 ` Kent Overstreet
2013-01-29 19:29 ` Tejun Heo
2013-01-29 19:51 ` Kent Overstreet
2013-01-29 20:02 ` Tejun Heo
2013-01-29 21:45 ` Kent Overstreet
2013-01-29 22:06 ` Tejun Heo
2013-01-29 18:04 ` [PATCH] module: Convert to generic percpu refcounts Kent Overstreet
2013-01-28 18:07 ` [PATCH] generic dynamic per cpu refcounting Kent Overstreet
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=20130128185039.GA19235@redhat.com \
--to=oleg@redhat.com \
--cc=koverstreet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=tj@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