On Mon, 7 Apr 2025 11:15:51 +0900
Masami Hiramatsu (Google) <[email protected]> wrote:

> > +static int alloc_hist_pad(void)
> > +{
> > +   lockdep_assert_held(&event_mutex);
> > +
> > +   if (refcount_read(&hist_pad_ref)) {
> > +           refcount_inc(&hist_pad_ref);  
> 
> nit: If this always runs under event_mutex, do we need to use atomic
> refcount_t?

refcount has a bunch of debugging that will trigger if the refcount
goes bad (negative and such) so that I don't need to add those checks.

Basically, refcount is for refcounting, and this is a ref counter ;-)

It's a slow path, so I don't care about the added overhead from using an
atomic.

> 
> Others looks good to me.
> 
> Reviewed-by: Masami Hiramatsu (Google) <[email protected]>

Thanks!

-- Steve


Reply via email to