Skip to content

Commit c438f14

Browse files
committed
tracing: Make ftrace_trace_userstack() static and conditional
It's only used in trace.c and there is absolutely no point in compiling it in when user space stack traces are not supported. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Alexander Potapenko <glider@google.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: linux-mm@kvack.org Cc: David Rientjes <rientjes@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: kasan-dev@googlegroups.com Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Cc: Akinobu Mita <akinobu.mita@gmail.com> Cc: Christoph Hellwig <hch@lst.de> Cc: iommu@lists.linux-foundation.org Cc: Robin Murphy <robin.murphy@arm.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: David Sterba <dsterba@suse.com> Cc: Chris Mason <clm@fb.com> Cc: Josef Bacik <josef@toxicpanda.com> Cc: linux-btrfs@vger.kernel.org Cc: dm-devel@redhat.com Cc: Mike Snitzer <snitzer@redhat.com> Cc: Alasdair Kergon <agk@redhat.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: intel-gfx@lists.freedesktop.org Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: dri-devel@lists.freedesktop.org Cc: David Airlie <airlied@linux.ie> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Tom Zanussi <tom.zanussi@linux.intel.com> Cc: Miroslav Benes <mbenes@suse.cz> Cc: linux-arch@vger.kernel.org Link: https://lkml.kernel.org/r/20190425094803.162400595@linutronix.de
1 parent 2a820bf commit c438f14

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

‎kernel/trace/trace.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ static union trace_eval_map_item *trace_eval_maps;
159159
#endif /* CONFIG_TRACE_EVAL_MAP_FILE */
160160

161161
static int tracing_set_tracer(struct trace_array *tr, const char *buf);
162+
static void ftrace_trace_userstack(struct ring_buffer *buffer,
163+
unsigned long flags, int pc);
162164

163165
#define MAX_TRACER_SIZE 100
164166
static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata;
@@ -2905,9 +2907,10 @@ void trace_dump_stack(int skip)
29052907
}
29062908
EXPORT_SYMBOL_GPL(trace_dump_stack);
29072909

2910+
#ifdef CONFIG_USER_STACKTRACE_SUPPORT
29082911
static DEFINE_PER_CPU(int, user_stack_count);
29092912

2910-
void
2913+
static void
29112914
ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
29122915
{
29132916
struct trace_event_call *call = &event_user_stack;
@@ -2958,13 +2961,12 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
29582961
out:
29592962
preempt_enable();
29602963
}
2961-
2962-
#ifdef UNUSED
2963-
static void __trace_userstack(struct trace_array *tr, unsigned long flags)
2964+
#else /* CONFIG_USER_STACKTRACE_SUPPORT */
2965+
static void ftrace_trace_userstack(struct ring_buffer *buffer,
2966+
unsigned long flags, int pc)
29642967
{
2965-
ftrace_trace_userstack(tr, flags, preempt_count());
29662968
}
2967-
#endif /* UNUSED */
2969+
#endif /* !CONFIG_USER_STACKTRACE_SUPPORT */
29682970

29692971
#endif /* CONFIG_STACKTRACE */
29702972

‎kernel/trace/trace.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -782,17 +782,9 @@ void update_max_tr_single(struct trace_array *tr,
782782
#endif /* CONFIG_TRACER_MAX_TRACE */
783783

784784
#ifdef CONFIG_STACKTRACE
785-
void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags,
786-
int pc);
787-
788785
void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
789786
int pc);
790787
#else
791-
static inline void ftrace_trace_userstack(struct ring_buffer *buffer,
792-
unsigned long flags, int pc)
793-
{
794-
}
795-
796788
static inline void __trace_stack(struct trace_array *tr, unsigned long flags,
797789
int skip, int pc)
798790
{

0 commit comments

Comments
 (0)