linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 12/17] fgraph: Make overruns 4 bytes in graph stack structure
Date: Wed, 11 Nov 2020 19:32:56 -0500	[thread overview]
Message-ID: <20201112003334.906341178@goodmis.org> (raw)
In-Reply-To: 20201112003244.764326960@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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>
---
 include/linux/ftrace.h               | 4 ++--
 kernel/trace/trace_entries.h         | 4 ++--
 kernel/trace/trace_functions_graph.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 806196345c3f..8dde9c17aaa5 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -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*/
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h
index 18c4a58aff79..ceafe2dc97e1 100644
--- a/kernel/trace/trace_entries.h
+++ b/kernel/trace/trace_entries.h
@@ -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",
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 60d66278aa0d..d874dec87131 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -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,
-- 
2.28.0



  parent reply	other threads:[~2020-11-12  1:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  0:32 [for-next][PATCH 00/17] tracing: Updates for 5.11 Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 01/17] ftrace: Move the recursion testing into global headers Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 02/17] ftrace: Add ftrace_test_recursion_trylock() helper function Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 03/17] ftrace: Optimize testing what context current is in Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 04/17] pstore/ftrace: Add recursion protection to the ftrace callback Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 05/17] kprobes/ftrace: " Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 06/17] livepatch/ftrace: " Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 07/17] livepatch: Trigger WARNING if livepatch function fails due to recursion Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 08/17] perf/ftrace: Add recursion protection to the ftrace callback Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 09/17] perf/ftrace: Check for rcu_is_watching() in callback function Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 10/17] ftrace: Reverse what the RECURSION flag means in the ftrace_ops Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 11/17] ftrace: Add recording of functions that caused recursion Steven Rostedt
2020-11-12  0:32 ` Steven Rostedt [this message]
2020-11-12  9:18   ` [for-next][PATCH 12/17] fgraph: Make overruns 4 bytes in graph stack structure David Laight
2020-11-12 14:39     ` Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 13/17] ftrace: Clean up the recursion code a bit Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 14/17] ring-buffer: Add recording of ring buffer recursion into recursed_functions Steven Rostedt
2020-11-12  0:32 ` [for-next][PATCH 15/17] ftrace: Remove unused varible ret Steven Rostedt
2020-11-12  0:33 ` [for-next][PATCH 16/17] tracing: Fix some typos in comments Steven Rostedt
2020-11-12  0:33 ` [for-next][PATCH 17/17] MAINTAINERS: assign ./fs/tracefs to TRACING Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112003334.906341178@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).