Re: [PATCH v3 4/9] percpu-refcount: Introduce percpu_ref_read()
From: Bart Van Assche <hidden>
Date: 2018-08-06 17:28:52
From: Bart Van Assche <hidden>
Date: 2018-08-06 17:28:52
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.
Hello Tejun, I will try to come up with an approach that does not require to modify the per-cpu counter code. Thanks, Bart.