Re: [PATCH v4 0/9] perf c2c: add a function view
From: Jiebin Sun
Date: Fri Jul 31 2026 - 03:40:18 EST
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.
Thanks,
Jiebin