Re: [PATCH 1/9] percpu-refcount: introduce percpu_ref_is_dead()
On Fri, Sep 01, 2017 at 06:59:15AM -0700, Tejun Heo wrote: > Hello, Ming. > > > +/** > > + * percpu_ref_is_dead - test whether a percpu refcount is killed > > + * @ref: percpu_ref to test > > + * > > + * Returns %true if @ref is dead > > + * > > + * This function is safe to call as long as @ref is between init and exit. > > + */ > > +static inline bool percpu_ref_is_dead(struct percpu_ref *ref) > > +{ > > + unsigned long __percpu *percpu_count; > > + > > + if (__ref_is_percpu(ref, _count)) > > + return false; > > + return ref->percpu_count_ptr & __PERCPU_REF_DEAD; > > +} > > Can you please explain why percpu_ref_is_dying() isn't enough for your > use case? Hi Tejun, You are right, looks percpu_ref_is_dying() is enough, percpu_ref_get_many() works fine no matter the ref is dying or not. Thanks! -- Ming
Re: [PATCH 1/9] percpu-refcount: introduce percpu_ref_is_dead()
On Fri, 2017-09-01 at 06:59 -0700, Tejun Heo wrote: > > +/** > > + * percpu_ref_is_dead - test whether a percpu refcount is killed > > + * @ref: percpu_ref to test > > + * > > + * Returns %true if @ref is dead > > + * > > + * This function is safe to call as long as @ref is between init and exit. > > + */ > > +static inline bool percpu_ref_is_dead(struct percpu_ref *ref) > > +{ > > + unsigned long __percpu *percpu_count; > > + > > + if (__ref_is_percpu(ref, _count)) > > + return false; > > + return ref->percpu_count_ptr & __PERCPU_REF_DEAD; > > +} > > Can you please explain why percpu_ref_is_dying() isn't enough for your > use case? Hello Tejun, The approach of the whole series is wrong so I think that you can ignore this patch. Bart.
Re: [PATCH 1/9] percpu-refcount: introduce percpu_ref_is_dead()
Hello, Ming. > +/** > + * percpu_ref_is_dead - test whether a percpu refcount is killed > + * @ref: percpu_ref to test > + * > + * Returns %true if @ref is dead > + * > + * This function is safe to call as long as @ref is between init and exit. > + */ > +static inline bool percpu_ref_is_dead(struct percpu_ref *ref) > +{ > + unsigned long __percpu *percpu_count; > + > + if (__ref_is_percpu(ref, _count)) > + return false; > + return ref->percpu_count_ptr & __PERCPU_REF_DEAD; > +} Can you please explain why percpu_ref_is_dying() isn't enough for your use case? Thanks. -- tejun