lkml.org 
[lkml]   [2016]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/8] ftrace: only allocate the ret_stack 'fp' field when needed
    Date
    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 <jpoimboe@redhat.com>
    ---
    include/linux/ftrace.h | 2 ++
    kernel/trace/trace_functions_graph.c | 2 ++
    2 files changed, 4 insertions(+)

    diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
    index 7d565af..4ad9ccc 100644
    --- a/include/linux/ftrace.h
    +++ b/include/linux/ftrace.h
    @@ -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
    };

    /*
    diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
    index fc173cd..0e03ed0 100644
    --- a/kernel/trace/trace_functions_graph.c
    +++ b/kernel/trace/trace_functions_graph.c
    @@ -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;
    --
    2.7.4
    \
     
     \ /
      Last update: 2016-09-17 09:57    [W:3.016 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site