diff options
author | Tejun Heo <tj@kernel.org> | 2013-06-14 06:23:53 +0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-06-14 06:23:53 +0400 |
commit | dbece3a0f1ef0b19aff1cc6ed0942fec9ab98de1 (patch) | |
tree | 3f594245c15b2f3ae8de6ec0c339e024988d22c4 /include/linux/kmod.h | |
parent | bc497bd33b2d6a6f07bc8574b4764edbd7fdffa8 (diff) | |
download | linux-dbece3a0f1ef0b19aff1cc6ed0942fec9ab98de1.tar.xz |
percpu-refcount: implement percpu_tryget() along with percpu_ref_kill_and_confirm()
Implement percpu_tryget() which stops giving out references once the
percpu_ref is visible as killed. Because the refcnt is per-cpu,
different CPUs will start to see a refcnt as killed at different
points in time and tryget() may continue to succeed on subset of cpus
for a while after percpu_ref_kill() returns.
For use cases where it's necessary to know when all CPUs start to see
the refcnt as dead, percpu_ref_kill_and_confirm() is added. The new
function takes an extra argument @confirm_kill which is invoked when
the refcnt is guaranteed to be viewed as killed on all CPUs.
While this isn't the prettiest interface, it doesn't force synchronous
wait and is much safer than requiring the caller to do its own
call_rcu().
v2: Patch description rephrased to emphasize that tryget() may
continue to succeed on some CPUs after kill() returns as suggested
by Kent.
v3: Function comment in percpu_ref_kill_and_confirm() updated warning
people to not depend on the implied RCU grace period from the
confirm callback as it's an implementation detail.
Signed-off-by: Tejun Heo <tj@kernel.org>
Slightly-Grumpily-Acked-by: Kent Overstreet <koverstreet@google.com>
Diffstat (limited to 'include/linux/kmod.h')
0 files changed, 0 insertions, 0 deletions