Re: [PATCH v3 4/9] percpu-refcount: Introduce percpu_ref_read()

Bart Van Assche
2018-08-06T17:28:52Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-7", Size: 934 bytes --]

On Mon, 2018-08-06 at 10:18 -0700, Tejun Heo wrote:
+AD4- I'm worried that this is too inviting for misuses and subtle problems=
.
+AD4- For example, your patch which uses this function uses
+AD4- synchronize+AF8-rcu() to synchronize against per-cpu counts after the
+AD4- first snoop+ADs- however, percpu+AF8-ref uses sched rcu, not the regu=
lar one,
+AD4- so depending on the config, this will lead to +ACo-really+ACo- subtle
+AD4- failures. Even if that gets fixed, it's still leaking percpu-ref
+AD4- internal details to its users - details which may change in the futur=
e
+AD4- and will cause super subtle bugs.
+AD4-=20
+AD4- I'd go for something a lot more specific, like percpu+AF8-ref+AF8-is+=
AF8-one(), so
+AD4- that all the magics can be contained in percpu-ref implementation
+AD4- 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.