Kent Overstreet
215e262f2a
percpu: implement generic percpu refcounting
...
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.
[[email protected] : fix build]
[[email protected] : coding-style tweak]
Signed-off-by: Kent Overstreet <[email protected] >
Cc: Zach Brown <[email protected] >
Cc: Felipe Balbi <[email protected] >
Cc: Greg Kroah-Hartman <[email protected] >
Cc: Mark Fasheh <[email protected] >
Cc: Joel Becker <[email protected] >
Cc: Rusty Russell <[email protected] >
Cc: Jens Axboe <[email protected] >
Cc: Asai Thambi S P <[email protected] >
Cc: Selvan Mani <[email protected] >
Cc: Sam Bradshaw <[email protected] >
Cc: Jeff Moyer <[email protected] >
Cc: Al Viro <[email protected] >
Cc: Benjamin LaHaise <[email protected] >
Cc: Tejun Heo <[email protected] >
Cc: Oleg Nesterov <[email protected] >
Cc: Christoph Lameter <[email protected] >
Cc: Ingo Molnar <[email protected] >
Reviewed-by: "Theodore Ts'o" <[email protected] >
Signed-off-by: Tejun Heo <[email protected] >
2013-06-03 15:36:41 -07:00