lkml.org 
[lkml]   [2020]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V6 1/2] percpu_ref: reduce memory footprint of percpu_ref in fast path
On Wed, Sep 30, 2020 at 04:26:56PM +0800, Ming Lei wrote:
> diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h
> index 87d8a38bdea1..1d6ed9ca23dd 100644
> --- a/include/linux/percpu-refcount.h
> +++ b/include/linux/percpu-refcount.h
> @@ -92,18 +92,23 @@ enum {
> PERCPU_REF_ALLOW_REINIT = 1 << 2,
> };
>
> -struct percpu_ref {
> +struct percpu_ref_data {
> atomic_long_t count;
> - /*
> - * The low bit of the pointer indicates whether the ref is in percpu
> - * mode; if set, then get/put will manipulate the atomic_t.
> - */
> - unsigned long percpu_count_ptr;
> percpu_ref_func_t *release;
> percpu_ref_func_t *confirm_switch;
> bool force_atomic:1;
> bool allow_reinit:1;
> struct rcu_head rcu;
> + struct percpu_ref *ref;
> +};
> +
> +struct percpu_ref {
> + /*
> + * The low bit of the pointer indicates whether the ref is in percpu
> + * mode; if set, then get/put will manipulate the atomic_t.
> + */
> + unsigned long percpu_count_ptr;
> + struct percpu_ref_data *data;
> };

Can you please add a comment explaining why the two structs are split?

Thanks.

--
tejun

\
 
 \ /
  Last update: 2020-09-30 18:01    [W:0.031 / U:36.852 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site