Re: [PATCH v3] tracing: Move histogram trigger variables from stack to per CPU structure
From: Steven Rostedt
Date: Mon Apr 07 2025 - 10:53:27 EST
On Mon, 7 Apr 2025 11:15:51 +0900
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> 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) <mhiramat@xxxxxxxxxx>
Thanks!
-- Steve