Skip to content

Commit 60602cb

Browse files
committed
fgraph: Make overruns 4 bytes in graph stack structure
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>
1 parent 773c167 commit 60602cb

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎include/linux/ftrace.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,11 @@ struct ftrace_graph_ent {
864864
*/
865865
struct ftrace_graph_ret {
866866
unsigned long func; /* Current function */
867+
int depth;
867868
/* Number of functions that overran the depth limit for current task */
868-
unsigned long overrun;
869+
unsigned int overrun;
869870
unsigned long long calltime;
870871
unsigned long long rettime;
871-
int depth;
872872
} __packed;
873873

874874
/* Type of the callback handlers for tracing function graph*/

‎kernel/trace/trace_entries.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry,
9393
F_STRUCT(
9494
__field_struct( struct ftrace_graph_ret, ret )
9595
__field_packed( unsigned long, ret, func )
96-
__field_packed( unsigned long, ret, overrun )
96+
__field_packed( int, ret, depth )
97+
__field_packed( unsigned int, ret, overrun )
9798
__field_packed( unsigned long long, ret, calltime)
9899
__field_packed( unsigned long long, ret, rettime )
99-
__field_packed( int, ret, depth )
100100
),
101101

102102
F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d",

‎kernel/trace/trace_functions_graph.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
957957

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

963963
print_graph_irq(iter, trace->func, TRACE_GRAPH_RET,

0 commit comments

Comments
 (0)