Re: [PATCH] Generic percpu refcounting

From: Tejun Heo
Date: Mon Jun 03 2013 - 18:39:47 EST

On Fri, May 31, 2013 at 03:26:45PM -0700, Kent Overstreet wrote:
> This implements a refcount with similar semantics to
> atomic_get()/atomic_dec_and_test() - but percpu.
> 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()).
> It's also legal to call percpu_ref_kill() multiple times - it only returns
> true once, so callers don't have to reimplement shutdown synchronization.
> [akpm@xxxxxxxxxxxxxxxxxxxx: fix build]
> [akpm@xxxxxxxxxxxxxxxxxxxx: coding-style tweak]
> Signed-off-by: Kent Overstreet <koverstreet@xxxxxxxxxx>
> Cc: Zach Brown <zab@xxxxxxxxxx>
> Cc: Felipe Balbi <balbi@xxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: Mark Fasheh <mfasheh@xxxxxxxx>
> Cc: Joel Becker <jlbec@xxxxxxxxxxxx>
> Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> Cc: Jens Axboe <axboe@xxxxxxxxx>
> Cc: Asai Thambi S P <asamymuthupa@xxxxxxxxxx>
> Cc: Selvan Mani <smani@xxxxxxxxxx>
> Cc: Sam Bradshaw <sbradshaw@xxxxxxxxxx>
> Cc: Jeff Moyer <jmoyer@xxxxxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Benjamin LaHaise <bcrl@xxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
> Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Reviewed-by: "Theodore Ts'o" <tytso@xxxxxxx>
> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>

Applied to percpu/for-3.11. Andrew, I removed your SOB as the patch
is routed outside -mm. Please let me know if you want
reviewed/ackd-by added.

git:// for-3.11

Thanks a lot!

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at