From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756092AbcH2UHH (ORCPT ); Mon, 29 Aug 2016 16:07:07 -0400 Received: from smtprelay0055.hostedemail.com ([216.40.44.55]:54024 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752296AbcH2UHF (ORCPT ); Mon, 29 Aug 2016 16:07:05 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2691:2895:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:4605:5007:6261:7774:7875:10004:10400:10562:10848:10967:11026:11232:11473:11658:11914:12043:12438:12555:12663:12740:13439:14181:14659:14721:21063:21080:30045:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: trade05_20464e5898205 X-Filterd-Recvd-Size: 3792 Date: Mon, 29 Aug 2016 16:07:00 -0400 From: Steven Rostedt To: Namhyung Kim Cc: LKML , Ingo Molnar , Josh Poimboeuf Subject: Re: [PATCH] ftrace: Access ret_stack->subtime only in the function profiler Message-ID: <20160829160700.71dc249a@gandalf.local.home> In-Reply-To: <20160829030518.5383-1-namhyung@kernel.org> References: <20160829030518.5383-1-namhyung@kernel.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 Aug 2016 12:05:18 +0900 Namhyung Kim wrote: > The subtime is used only for function profiler with function graph > tracer enabled. Move the definition of subtime under > CONFIG_FUNCTION_PROFILER to reduce the memory usage. Also move the > initialization of subtime into the graph entry callback. Hmm, I think documentation needs to be updated. Although it was never implemented, I believe I added the subtime to not only work with the profiler, but also with the normal tracing (to have the time of the internal functions subtracted from the upper level functions). But it appears that part was never implemented. I'm fine with the patch, or actually implementing what graph-time states in Documentation/ftrace.txt. If we take this patch, that comment needs to be made to only mention the profiler (and the option should only be shown when the profiler is enabled). -- Steve > > Cc: Josh Poimboeuf > Signed-off-by: Namhyung Kim > --- > include/linux/ftrace.h | 2 ++ > kernel/trace/ftrace.c | 6 ++++++ > kernel/trace/trace_functions_graph.c | 1 - > 3 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h > index 6f93ac46e7f0..b3d34d3e0e7e 100644 > --- a/include/linux/ftrace.h > +++ b/include/linux/ftrace.h > @@ -794,7 +794,9 @@ struct ftrace_ret_stack { > unsigned long ret; > unsigned long func; > unsigned long long calltime; > +#ifdef CONFIG_FUNCTION_PROFILER > unsigned long long subtime; > +#endif > #ifdef HAVE_FUNCTION_GRAPH_FP_TEST > unsigned long fp; > #endif > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 84752c8e28b5..2050a7652a86 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -872,7 +872,13 @@ function_profile_call(unsigned long ip, unsigned long parent_ip, > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > static int profile_graph_entry(struct ftrace_graph_ent *trace) > { > + int index = trace->depth; > + > function_profile_call(trace->func, 0, NULL, NULL); > + > + if (index >= 0 && index < FTRACE_RETFUNC_DEPTH) > + current->ret_stack[index].subtime = 0; > + > return 1; > } > > diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c > index 0cbe38a844fa..9c7ffa4df5a8 100644 > --- a/kernel/trace/trace_functions_graph.c > +++ b/kernel/trace/trace_functions_graph.c > @@ -170,7 +170,6 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth, > current->ret_stack[index].ret = ret; > 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