On Thu, Nov 13, 2025 at 10:38 AM Donglin Peng <[email protected]> wrote:
>
> On Thu, Nov 13, 2025 at 10:02 AM Steven Rostedt <[email protected]> wrote:
> >
> > On Thu, 13 Nov 2025 09:48:52 +0800
> > Donglin Peng <[email protected]> wrote:
> >
> > > I noticed that when funcgraph-args is enabled, it registers
> > > trace_graph_entry_args
> > > to replace trace_graph_entry. The only difference is whether a valid
> > > fregs pointer
> > > is passed.
> > >
> > > To reduce overhead, I propose consolidating the two entry functions. We 
> > > could
> > > maintain only trace_graph_entry and pass the fregs parameter to 
> > > graph_entry.
> > > Within __graph_entry, we can then conditionally record arguments based on
> > > 'TRACE_GRAPH_ARGS && !!fregs'.
> >
> > What overhead are you reducing?  Why add a branch statement in a critical 
> > path?
>
> Thanks. During testing, I found that enabling funcgraph-args incurs 
> significant
> overhead (344ms) compared to other trace options (near-zero).
>
> # time echo 1 > options/funcgraph-retaddr
>
> real    0m0.000s
> user    0m0.000s
> sys     0m0.000s
>
> # time  echo 1 > options/funcgraph-args
>
> real    0m0.344s
> user    0m0.000s
> sys     0m0.344s
>
> So I thought it may need to be optimized.
>
> >
> > The graph_entry() should not be looking at the flags argument. It's called
> > by *every function*. Also note, I recently fixed the flags to be per
> > instance and not global. Which means testing the flags would require
> > indirection lookups.
>
> Thanks, I agree and it indeed introduces extra branch instruction and
> may introduce more overhead when using indirection lookups.

Is it necessary to do the same thing for funcgraph-retaddr considering
that it checks the global tracer_flags in the graph_entry?

>
> >
> > -- Steve

Reply via email to