Skip to content

Commit

Permalink
tracing/function-graph-tracer: use the more lightweight local clock
Browse files Browse the repository at this point in the history
Impact: decrease hangs risks with the graph tracer on slow systems

Since the function graph tracer can spend too much time on timer
interrupts, it's better now to use the more lightweight local
clock. Anyway, the function graph traces are more reliable on a
per cpu trace.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <49af243d.06e9300a.53ad.ffff840c@mx.google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Mar 5, 2009
1 parent c4ef144 commit 0012693
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
return;
}

calltime = cpu_clock(raw_smp_processor_id());
calltime = trace_clock_local();

if (ftrace_push_return_trace(old, calltime,
self_addr, &trace.depth) == -EBUSY) {
Expand Down
13 changes: 7 additions & 6 deletions include/linux/ftrace.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#ifndef _LINUX_FTRACE_H
#define _LINUX_FTRACE_H

#include <linux/linkage.h>
#include <linux/fs.h>
#include <linux/ktime.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/trace_clock.h>
#include <linux/kallsyms.h>
#include <linux/linkage.h>
#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/ktime.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/fs.h>

#include <asm/ftrace.h>

Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_functions_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ unsigned long ftrace_return_to_handler(void)
unsigned long ret;

ftrace_pop_return_trace(&trace, &ret);
trace.rettime = cpu_clock(raw_smp_processor_id());
trace.rettime = trace_clock_local();
ftrace_graph_return(&trace);

if (unlikely(!ret)) {
Expand Down

0 comments on commit 0012693

Please sign in to comment.