[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130515090053.GC16164@moria.home.lan>
Date: Wed, 15 May 2013 02:00:53 -0700
From: Kent Overstreet <koverstreet@...gle.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-aio@...ck.org,
akpm@...ux-foundation.org, Zach Brown <zab@...hat.com>,
Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Mark Fasheh <mfasheh@...e.com>,
Joel Becker <jlbec@...lplan.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Jens Axboe <axboe@...nel.dk>,
Asai Thambi S P <asamymuthupa@...ron.com>,
Selvan Mani <smani@...ron.com>,
Sam Bradshaw <sbradshaw@...ron.com>,
Jeff Moyer <jmoyer@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>,
Benjamin LaHaise <bcrl@...ck.org>,
Christoph Lameter <cl@...ux-foundation.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH 04/21] Generic percpu refcounting
On Tue, May 14, 2013 at 05:28:36PM +0200, Oleg Nesterov wrote:
> On 05/14, Tejun Heo wrote:
> >
> > > +int percpu_ref_tryget(struct percpu_ref *ref)
> > > +{
> > > + int ret = 1;
> > > +
> > > + preempt_disable();
> > > +
> > > + if (!percpu_ref_dead(ref))
> > > + percpu_ref_get(ref);
> > > + else
> > > + ret = 0;
> > > +
> > > + preempt_enable();
> > > +
> > > + return ret;
> > > +}
> ...
> > BTW, why is this
> > function necessary? What's the use case?
>
> Yes, I was wondering too.
>
> And please note that this code _looks_ wrong, percpu_ref_get() still
> can increment ref->count.
Yeah I see what you mean, I changed how ret is set.
But also splitting tryget() and count() out into another patch to go
with the module conversion.
> Hmm. Just noticed this comment above percpu_ref_kill()
>
> * The caller must issue a synchronize_rcu()/call_rcu() before calling
> * percpu_ref_put() to drop the initial ref.
>
> Really?
That's also left over from the dynamic version, whoops.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists