Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48078d2d authored by Liam R. Howlett's avatar Liam R. Howlett Committed by David S. Miller
Browse files

sparc/ftrace: Fix ftrace graph time measurement



The ftrace function_graph time measurements of a given function is not
accurate according to those recorded by ftrace using the function
filters.  This change pulls the x86_64 fix from 'commit 722b3c74
("ftrace/graph: Trace function entry before updating index")' into the
sparc specific prepare_ftrace_return which stops ftrace from
counting interrupted tasks in the time measurement.

Example measurements for select_task_rq_fair running "hackbench 100
process 1000":

              |  tracing/trace_stat/function0  |  function_graph
 Before patch |  2.802 us                      |  4.255 us
 After patch  |  2.749 us                      |  3.094 us

Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent deba804c
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -130,17 +130,16 @@ unsigned long prepare_ftrace_return(unsigned long parent,
	if (unlikely(atomic_read(&current->tracing_graph_pause)))
		return parent + 8UL;

	if (ftrace_push_return_trace(parent, self_addr, &trace.depth,
				     frame_pointer, NULL) == -EBUSY)
		return parent + 8UL;

	trace.func = self_addr;
	trace.depth = current->curr_ret_stack + 1;

	/* Only trace if the calling function expects to */
	if (!ftrace_graph_entry(&trace)) {
		current->curr_ret_stack--;
	if (!ftrace_graph_entry(&trace))
		return parent + 8UL;

	if (ftrace_push_return_trace(parent, self_addr, &trace.depth,
				     frame_pointer, NULL) == -EBUSY)
		return parent + 8UL;
	}

	return return_hooker;
}