Re: [PATCH v3 4/9] percpu-refcount: Introduce percpu_ref_read()
From: Bart Van Assche <hidden>
Date: 2018-08-07 22:53:45
From: Bart Van Assche <hidden>
Date: 2018-08-07 22:53:45
On Mon, 2018-08-06 at 10:18 -0700, Tejun Heo wrote:
I'm worried that this is too inviting for misuses and subtle problems=
.
For example, your patch which uses this function uses synchronize_rcu() to synchronize against per-cpu counts after the first snoop; however, percpu_ref uses sched rcu, not the regu=
lar one,
so depending on the config, this will lead to *really* subtle failures. Even if that gets fixed, it's still leaking percpu-ref internal details to its users - details which may change in the futur=
e
and will cause super subtle bugs. =20 I'd go for something a lot more specific, like percpu_ref_is�
AF8-one(), so
that all the magics can be contained in percpu-ref implementation proper.
Hi Tejun, Can you have a look at the new percpu_ref_is_in_use() funct= ion? Please also note that the synchronize_rcu() call between the two percpu_ref_= -is_in_use() calls is not related to the use of RCU in the per-cpu refcount implementati= on. Thanks, Bart.