ftrace: Only allocate the ret_stack 'fp' field when needed
authorJosh Poimboeuf <[email protected]>
Fri, 19 Aug 2016 11:52:56 +0000 (06:52 -0500)
committerIngo Molnar <[email protected]>
Wed, 24 Aug 2016 10:15:14 +0000 (12:15 +0200)
This saves some memory when HAVE_FUNCTION_GRAPH_FP_TEST isn't defined.
On x86_64 with newer versions of gcc which have -mfentry, it saves 400
bytes per task.

Signed-off-by: Josh Poimboeuf <[email protected]>
Acked-by: Steven Rostedt <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Kees Cook <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Nilay Vaish <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/5c7747d9ea7b5cb47ef0a8ce8a6cea6bf7aa94bf.1471607358.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <[email protected]>
include/linux/ftrace.h
kernel/trace/trace_functions_graph.c

index 7d565afe35d2fa9ba25359c9bf879d8bde9893e7..4ad9ccc60e387381368874b34d810a688f8c740b 100644 (file)
@@ -795,7 +795,9 @@ struct ftrace_ret_stack {
        unsigned long func;
        unsigned long long calltime;
        unsigned long long subtime;
+#ifdef HAVE_FUNCTION_GRAPH_FP_TEST
        unsigned long fp;
+#endif
 };
 
 /*
index fc173cd9fbfd3a0aa24513f79ed817fc2b80b497..0e03ed0eac68870842359ccb975e0772f6b28456 100644 (file)
@@ -171,7 +171,9 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
        current->ret_stack[index].func = func;
        current->ret_stack[index].calltime = calltime;
        current->ret_stack[index].subtime = 0;
+#ifdef HAVE_FUNCTION_GRAPH_FP_TEST
        current->ret_stack[index].fp = frame_pointer;
+#endif
        *depth = current->curr_ret_stack;
 
        return 0;