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 regular 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 future > and will cause super subtle bugs. > > I'd go for something a lot more specific, like percpu_ref_is_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() function? 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 implementation. Thanks, Bart.
