Skip to content

Commit

Permalink
fgraph: Make overruns 4 bytes in graph stack structure
Browse files Browse the repository at this point in the history
Inspecting the data structures of the function graph tracer, I found that
the overrun value is unsigned long, which is 8 bytes on a 64 bit machine,
and not only that, the depth is an int (4 bytes). The overrun can be simply
an unsigned int (4 bytes) and pack the ftrace_graph_ret structure better.

The depth is moved up next to the func, as it is used more often with func,
and improves cache locality.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (VMware) committed Nov 11, 2020
1 parent 773c167 commit 60602cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -864,11 +864,11 @@ struct ftrace_graph_ent {
*/
struct ftrace_graph_ret {
unsigned long func; /* Current function */
int depth;
/* Number of functions that overran the depth limit for current task */
unsigned long overrun;
unsigned int overrun;
unsigned long long calltime;
unsigned long long rettime;
int depth;
} __packed;

/* Type of the callback handlers for tracing function graph*/
Expand Down
4 changes: 2 additions & 2 deletions kernel/trace/trace_entries.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry,
F_STRUCT(
__field_struct( struct ftrace_graph_ret, ret )
__field_packed( unsigned long, ret, func )
__field_packed( unsigned long, ret, overrun )
__field_packed( int, ret, depth )
__field_packed( unsigned int, ret, overrun )
__field_packed( unsigned long long, ret, calltime)
__field_packed( unsigned long long, ret, rettime )
__field_packed( int, ret, depth )
),

F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d",
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,

/* Overrun */
if (flags & TRACE_GRAPH_PRINT_OVERRUN)
trace_seq_printf(s, " (Overruns: %lu)\n",
trace_seq_printf(s, " (Overruns: %u)\n",
trace->overrun);

print_graph_irq(iter, trace->func, TRACE_GRAPH_RET,
Expand Down

0 comments on commit 60602cb

Please sign in to comment.