Skip to content

Commit 15617df

Browse files
weiny2dennisszhou
authored andcommitted
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 <[email protected]> [Dennis: reworded] Signed-off-by: Dennis Zhou <[email protected]>
1 parent 98d54f8 commit 15617df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/percpu-refcount.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ static unsigned long __percpu *percpu_count_ptr(struct percpu_ref *ref)
5050
* @flags: PERCPU_REF_INIT_* flags
5151
* @gfp: allocation mask to use
5252
*
53-
* Initializes @ref. If @flags is zero, @ref starts in percpu mode with a
54-
* refcount of 1; analagous to atomic_long_set(ref, 1). See the
55-
* definitions of PERCPU_REF_INIT_* flags for flag behaviors.
53+
* Initializes @ref. @ref starts out in percpu mode with a refcount of 1 unless
54+
* @flags contains PERCPU_REF_INIT_ATOMIC or PERCPU_REF_INIT_DEAD. These flags
55+
* change the start state to atomic with the latter setting the initial refcount
56+
* to 0. See the definitions of PERCPU_REF_INIT_* flags for flag behaviors.
5657
*
5758
* Note that @release must not sleep - it may potentially be called from RCU
5859
* callback context by percpu_ref_kill().

0 commit comments

Comments
 (0)