Re: [PATCH v4 0/9] perf c2c: add a function view

Namhyung Kim <[email protected]> Fri, 31 Jul 2026 14:34:07 -0700
Newsgroups org.kernel.vger.linux-perf-users,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, Jul 31, 2026 at 03:44:20PM +0800, Jiebin Sun wrote:
> On Thu, Jul 30, 2026 at 07:43:59PM -0700, Namhyung Kim wrote:
> > Is it possible to add proper refcounts instead of borrowing?  I guess
> > that'd make the code simpler.
> 
> Yes, and it is simpler. Let me check the approach with you before I post v6.
> 
> The children now take their own references:
> 
>       child_he->ops = &c2c_function_entry_ops;
>       map_symbol__copy(&child_he->ms, &src_he->ms);   /* was memcpy() */
>       child_he->thread = thread__get(src_he->thread); /* was a raw assign */
> 
>       hist_entry__delete(child_he);                   /* was a custom free */
> 
> hist_entry__delete() takes care of thread/ms, mem_info, stat_acc and
> srcline/srcfile, and calls ops->free() for the c2c-private fields. So the
> custom destructor and the WARN_ON_ONCE(report_hierarchy) guard both go away.
> 
> Two sashiko comments fall out of this as well: the leaked srcline/srcfile and
> the missing ops are both covered by the generic destructor now, so I did not
> treat them separately. It also asked for NO_SLANG stubs for the two entry
> points declared in c2c.h, so I added them the way util/hist.h does.
> 
> If this looks right, I will send v6.

Sounds good to me.

Thanks,
Namhyung