Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759078AbcDHWMY (ORCPT ); Fri, 8 Apr 2016 18:12:24 -0400 Received: from smtprelay0216.hostedemail.com ([216.40.44.216]:43185 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752434AbcDHWMW (ORCPT ); Fri, 8 Apr 2016 18:12:22 -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:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2904:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:5007:6119:6261:6742:7875:7903:8660:10004:10400:10848:10967:11026:11232:11658:11914:12043:12114:12296:12438:12517:12519:12740:13019:13069:13138:13148:13230:13231:13311:13357:13439:14096:14097:14181:14659:14721:21080:21212:30054:30055:30064:30070: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: rest55_4e9d0b38d3b10 X-Filterd-Recvd-Size: 2798 Date: Fri, 8 Apr 2016 18:12:19 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Alexei Starovoitov , "David S . Miller" , Ingo Molnar , Daniel Borkmann , Arnaldo Carvalho de Melo , Wang Nan , Josef Bacik , Brendan Gregg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH net-next 1/8] perf: optimize perf_fetch_caller_regs Message-ID: <20160408181219.036c1216@gandalf.local.home> In-Reply-To: <20160405120626.GM3448@twins.programming.kicks-ass.net> References: <1459831974-2891931-1-git-send-email-ast@fb.com> <1459831974-2891931-2-git-send-email-ast@fb.com> <20160405120626.GM3448@twins.programming.kicks-ass.net> 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 Content-Length: 1487 Lines: 40 On Tue, 5 Apr 2016 14:06:26 +0200 Peter Zijlstra wrote: > On Mon, Apr 04, 2016 at 09:52:47PM -0700, Alexei Starovoitov wrote: > > avoid memset in perf_fetch_caller_regs, since it's the critical path of all tracepoints. > > It's called from perf_sw_event_sched, perf_event_task_sched_in and all of perf_trace_##call > > with this_cpu_ptr(&__perf_regs[..]) which are zero initialized by perpcu_alloc > > Its not actually allocated; but because its a static uninitialized > variable we get .bss like behaviour and the initial value is copied to > all CPUs when the per-cpu allocator thingy bootstraps SMP IIRC. > > > and > > subsequent call to perf_arch_fetch_caller_regs initializes the same fields on all archs, > > so we can safely drop memset from all of the above cases and > > Indeed. > > > move it into > > perf_ftrace_function_call that calls it with stack allocated pt_regs. > > Hmm, is there a reason that's still on-stack instead of using the > per-cpu thing, Steve? Well, what do you do when you are tracing with regs in an interrupt that already set the per cpu regs field? We could create our own per-cpu one as well, but then that would require checking which level we are in, as we can have one for normal context, one for softirq context, one for irq context and one for nmi context. -- Steve > > > Signed-off-by: Alexei Starovoitov > > In any case, > > Acked-by: Peter Zijlstra (Intel)