Re: [PATCH 23/32] Generic dynamic per cpu refcounting

From: Kent Overstreet
Date: Mon Jan 28 2013 - 12:52:52 EST


On Fri, Jan 25, 2013 at 04:45:10PM +1030, Rusty Russell wrote:
> Tejun Heo <tj@xxxxxxxxxx> writes:
> >> It also implements two stage shutdown, as we need it to tear down the
> >> percpu counts. Before dropping the initial refcount, you must call
> >> percpu_ref_kill(); this puts the refcount in "shutting down mode" and
> >> switches back to a single atomic refcount with the appropriate barriers
> >> (synchronize_rcu()).
> >
> > Maybe if we have tryget() which only succeeds if the counter is alive,
> > we can replace moulde refcnt with this? Rusty?
>
> Yes, it's similar (hence my previous interest), though module count is a
> bit weird.

I'll try and take a stab at converting it, if I can find time.

> Like Tejun, I'd prefer to see it always alloc up-front, because it
> avoids the _noalloc variant (which is backwards: please hand gfp_t, so
> you don't hide the alloc) and heuristics.

Problem with gfp_t is alloc_percpu() doesn't take it. I don't know why,
but this all goes away with Tejun's idea for allocating from a pool
refilled by workqueue.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/