* [PATCH] percpu_ref: Fix comment regarding percpu_ref_init flags
@ 2019-12-09 21:54 ira.weiny
2020-02-06 4:28 ` Ira Weiny
0 siblings, 1 reply; 2+ messages in thread
From: ira.weiny @ 2019-12-09 21:54 UTC (permalink / raw)
To: Sakari Ailus, linux-kernel; +Cc: Tejun Heo, Ira Weiny
From: Ira Weiny <ira.weiny@intel.com>
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>
---
lib/percpu-refcount.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
index 4f6c6ebbbbde..48d7fcff70b6 100644
--- a/lib/percpu-refcount.c
+++ b/lib/percpu-refcount.c
@@ -50,9 +50,9 @@ 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. If @flags is zero or PERCPU_REF_ALLOW_REINIT, @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.
*
* Note that @release must not sleep - it may potentially be called from RCU
* callback context by percpu_ref_kill().
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] percpu_ref: Fix comment regarding percpu_ref_init flags
2019-12-09 21:54 [PATCH] percpu_ref: Fix comment regarding percpu_ref_init flags ira.weiny
@ 2020-02-06 4:28 ` Ira Weiny
0 siblings, 0 replies; 2+ messages in thread
From: Ira Weiny @ 2020-02-06 4:28 UTC (permalink / raw)
To: Sakari Ailus, linux-kernel; +Cc: Tejun Heo
On Mon, Dec 09, 2019 at 01:54:20PM -0800, 'Ira Weiny' wrote:
> From: Ira Weiny <ira.weiny@intel.com>
>
> 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.
Did this get picked up? Or am I wrong in the comment?
Ira
>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> ---
> lib/percpu-refcount.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/percpu-refcount.c b/lib/percpu-refcount.c
> index 4f6c6ebbbbde..48d7fcff70b6 100644
> --- a/lib/percpu-refcount.c
> +++ b/lib/percpu-refcount.c
> @@ -50,9 +50,9 @@ 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. If @flags is zero or PERCPU_REF_ALLOW_REINIT, @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.
> *
> * Note that @release must not sleep - it may potentially be called from RCU
> * callback context by percpu_ref_kill().
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-06 4:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09 21:54 [PATCH] percpu_ref: Fix comment regarding percpu_ref_init flags ira.weiny
2020-02-06 4:28 ` Ira Weiny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).