diff options
author | Namhyung Kim <namhyung@kernel.org> | 2016-08-30 22:55:29 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-09-01 12:19:40 -0400 |
commit | 8861dd303cba879bae9a9dcee74042fb642bf03b (patch) | |
tree | 9395c7c589d846cc94cbed3a960131fa15c72db4 | |
parent | 613dccdf681aed9f9d1243bb2b8cd864a887802f (diff) |
ftrace: Access ret_stack->subtime only in the function profiler
The subtime is used only for function profiler with function graph
tracer enabled. Move the definition of subtime under
CONFIG_FUNCTION_PROFILER to reduce the memory usage. Also move the
initialization of subtime into the graph entry callback.
Link: http://lkml.kernel.org/r/20160831025529.24018-1-namhyung@kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | Documentation/trace/ftrace.txt | 10 | ||||
-rw-r--r-- | include/linux/ftrace.h | 2 | ||||
-rw-r--r-- | kernel/trace/ftrace.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 1 |
4 files changed, 13 insertions, 6 deletions
diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index a6b3705e62a6..185c39fea2a0 100644 --- a/Documentation/trace/ftrace.txt +++ b/Documentation/trace/ftrace.txt | |||
@@ -858,11 +858,11 @@ x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6] | |||
858 | When enabled, it will account time the task has been | 858 | When enabled, it will account time the task has been |
859 | scheduled out as part of the function call. | 859 | scheduled out as part of the function call. |
860 | 860 | ||
861 | graph-time - When running function graph tracer, to include the | 861 | graph-time - When running function profiler with function graph tracer, |
862 | time to call nested functions. When this is not set, | 862 | to include the time to call nested functions. When this is |
863 | the time reported for the function will only include | 863 | not set, the time reported for the function will only |
864 | the time the function itself executed for, not the time | 864 | include the time the function itself executed for, not the |
865 | for functions that it called. | 865 | time for functions that it called. |
866 | 866 | ||
867 | record-cmd - When any event or tracer is enabled, a hook is enabled | 867 | record-cmd - When any event or tracer is enabled, a hook is enabled |
868 | in the sched_switch trace point to fill comm cache | 868 | in the sched_switch trace point to fill comm cache |
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 7d565afe35d2..1e2b316d6693 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -794,7 +794,9 @@ struct ftrace_ret_stack { | |||
794 | unsigned long ret; | 794 | unsigned long ret; |
795 | unsigned long func; | 795 | unsigned long func; |
796 | unsigned long long calltime; | 796 | unsigned long long calltime; |
797 | #ifdef CONFIG_FUNCTION_PROFILER | ||
797 | unsigned long long subtime; | 798 | unsigned long long subtime; |
799 | #endif | ||
798 | unsigned long fp; | 800 | unsigned long fp; |
799 | }; | 801 | }; |
800 | 802 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 84752c8e28b5..2050a7652a86 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -872,7 +872,13 @@ function_profile_call(unsigned long ip, unsigned long parent_ip, | |||
872 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 872 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
873 | static int profile_graph_entry(struct ftrace_graph_ent *trace) | 873 | static int profile_graph_entry(struct ftrace_graph_ent *trace) |
874 | { | 874 | { |
875 | int index = trace->depth; | ||
876 | |||
875 | function_profile_call(trace->func, 0, NULL, NULL); | 877 | function_profile_call(trace->func, 0, NULL, NULL); |
878 | |||
879 | if (index >= 0 && index < FTRACE_RETFUNC_DEPTH) | ||
880 | current->ret_stack[index].subtime = 0; | ||
881 | |||
876 | return 1; | 882 | return 1; |
877 | } | 883 | } |
878 | 884 | ||
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index e14017c36170..148c90f1e49b 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -170,7 +170,6 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth, | |||
170 | current->ret_stack[index].ret = ret; | 170 | current->ret_stack[index].ret = ret; |
171 | current->ret_stack[index].func = func; | 171 | current->ret_stack[index].func = func; |
172 | current->ret_stack[index].calltime = calltime; | 172 | current->ret_stack[index].calltime = calltime; |
173 | current->ret_stack[index].subtime = 0; | ||
174 | current->ret_stack[index].fp = frame_pointer; | 173 | current->ret_stack[index].fp = frame_pointer; |
175 | *depth = current->curr_ret_stack; | 174 | *depth = current->curr_ret_stack; |
176 | 175 | ||