From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933061AbdHVPOQ (ORCPT ); Tue, 22 Aug 2017 11:14:16 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55384 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932913AbdHVPOP (ORCPT ); Tue, 22 Aug 2017 11:14:15 -0400 Date: Tue, 22 Aug 2017 17:14:10 +0200 From: Peter Zijlstra To: Jesper Dangaard Brouer Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Jiri Olsa , Ingo Molnar Subject: Re: [PATCH] trace: adjust code layout in get_recursion_context Message-ID: <20170822151410.xroe4mrkk32tlrxv@hirez.programming.kicks-ass.net> References: <150341282404.1960.2812166781523027528.stgit@firesoul> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <150341282404.1960.2812166781523027528.stgit@firesoul> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 22, 2017 at 04:40:24PM +0200, Jesper Dangaard Brouer wrote: > In an XDP redirect applications using tracepoint xdp:xdp_redirect to > diagnose TX overrun, I noticed perf_swevent_get_recursion_context() > was consuming 2% CPU. This was reduced to 1.6% with this simple > change. It is also incorrect. What do you suppose it now returns when the NMI hits a hard IRQ which hit during a Soft IRQ? > @@ -208,12 +208,12 @@ static inline int get_recursion_context(int *recursion) > { > int rctx; > > + if (in_softirq()) > + rctx = 1; > else if (in_irq()) > rctx = 2; > + else if (in_nmi()) > + rctx = 3; > else > rctx = 0; > >