diff options
author | Ira Weiny <ira.weiny@intel.com> | 2020-02-22 02:16:07 +0300 |
---|---|---|
committer | Dennis Zhou <dennis@kernel.org> | 2020-03-06 00:10:26 +0300 |
commit | 15617dffa387d2d80eefb9935c3a3985c4021090 (patch) | |
tree | 85b3c85916949f9b851d50936dc473a3491bf448 /lib/percpu-refcount.c | |
parent | 98d54f81e36ba3bf92172791eba5ca5bd813989b (diff) | |
download | linux-15617dffa387d2d80eefb9935c3a3985c4021090.tar.xz |
percpu_ref: Fix comment regarding percpu_ref_init flags
The comment for percpu_ref_init() implies that using
PERCPU_REF_ALLOW_REINIT will cause the refcount to start at 0. But
this is not true. PERCPU_REF_ALLOW_REINIT starts the count at 1 as
if the flags were zero. Add this fact to the kernel doc comment.
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
[Dennis: reworded]
Signed-off-by: Dennis Zhou <dennis@kernel.org>
Diffstat (limited to 'lib/percpu-refcount.c')
-rw-r--r-- | lib/percpu-refcount.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c index 4f6c6ebbbbde..8d092609928e 100644 --- a/lib/percpu-refcount.c +++ b/lib/percpu-refcount.c @@ -50,9 +50,10 @@ static unsigned long __percpu *percpu_count_ptr(struct percpu_ref *ref) * @flags: PERCPU_REF_INIT_* flags * @gfp: allocation mask to use * - * Initializes @ref. If @flags is zero, @ref starts in percpu mode with a - * refcount of 1; analagous to atomic_long_set(ref, 1). See the - * definitions of PERCPU_REF_INIT_* flags for flag behaviors. + * Initializes @ref. @ref starts out in percpu mode with a refcount of 1 unless + * @flags contains PERCPU_REF_INIT_ATOMIC or PERCPU_REF_INIT_DEAD. These flags + * change the start state to atomic with the latter setting the initial refcount + * to 0. See the definitions of PERCPU_REF_INIT_* flags for flag behaviors. * * Note that @release must not sleep - it may potentially be called from RCU * callback context by percpu_ref_kill(). |