• Vlastimil Babka's avatar
    x86/stacktrace: Avoid recording save_stack_trace() wrappers · 77072f09
    Vlastimil Babka authored
    The save_stack_trace() and save_stack_trace_tsk() wrappers of
    __save_stack_trace() add themselves to the call stack, and thus appear in the
    recorded stacktraces. This is redundant and wasteful when we have limited space
    to record the useful part of the backtrace with e.g. page_owner functionality.
    
    Fix this by making sure __save_stack_trace() is noinline (which matches the
    current gcc decision) and bumping the skip in the wrappers
    (save_stack_trace_tsk() only when called for the current task). This is similar
    to what was done for arm in 3683f44c ("ARM: stacktrace: avoid listing
    stacktrace functions in stacktrace") and is pending for arm64.
    
    Also make sure that __save_stack_trace_reliable() doesn't get this problem in
    the future by marking it __always_inline (which matches current gcc decision),
    per Josh Poimboeuf.
    Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
    Acked-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Miroslav Benes <mbenes@suse.cz>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/20170929092335.2744-1-vbabka@suse.czSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    77072f09
stacktrace.c 5.32 KB